Is there a way to make your app not go to areal screensaver?

Hi, I have a tvOS app that is a pong screensaver: https://itunes.apple.com/us/app/pong-screensaver/id1448061396?mt=8

There is a thing where it goes to the normal "Areal" screensaver, how do you make it not go there?

Accepted Reply

I figured it out.

        UIApplication.shared.isIdleTimerDisabled = true

I created the screensaver in SpriteKit based off of the Apple TV game template I added this line to GameViewController.swift in viewDidLoad().

My viewDidLoad() now looks like this:

import UIKit
import SpriteKit
import GameplayKit

class GameViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        UIApplication.shared.isIdleTimerDisabled = true
        if let view = self.view as! SKView? {
            // Load the SKScene from 'GameScene.sks'
            if let scene = SKScene(fileNamed: "GameScene") {
                // Set the scale mode to scale to fit the window
                scene.scaleMode = .aspectFill
                
                // Present the scene
                view.presentScene(scene)
            }
            
            view.ignoresSiblingOrder = true
            
            view.showsFPS = true
            view.showsNodeCount = true
        }
    }

}

Replies

I figured it out.

        UIApplication.shared.isIdleTimerDisabled = true

I created the screensaver in SpriteKit based off of the Apple TV game template I added this line to GameViewController.swift in viewDidLoad().

My viewDidLoad() now looks like this:

import UIKit
import SpriteKit
import GameplayKit

class GameViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        UIApplication.shared.isIdleTimerDisabled = true
        if let view = self.view as! SKView? {
            // Load the SKScene from 'GameScene.sks'
            if let scene = SKScene(fileNamed: "GameScene") {
                // Set the scale mode to scale to fit the window
                scene.scaleMode = .aspectFill
                
                // Present the scene
                view.presentScene(scene)
            }
            
            view.ignoresSiblingOrder = true
            
            view.showsFPS = true
            view.showsNodeCount = true
        }
    }

}