tvOS - how to stop OS from backgrounding my app

I have an Apple TV photo slideshow app (Objective-C, Storyboard based, transitioned to scenes and UIKit from old Appdelegate model) which is trivial but exhibits a problem I can't fix. The app has 2 UIImageViews, pulls photos from iCloud, replaces the back view, fades between them, swaps front and back images. I cannot for the life of me work out how to tell tvOS / UIKit that I need to stay in the foreground. Other slideshow apps manage it, clearly movie viewing apps like Netflix, Disney+ and BBC iPlayer manage to stay on top without the user needing to interact with the UI, but I keep getting pushed out. The pushing out happens only if I am playing music on the Apple TV, either using the built-in music app or AirPlaying music to the Apple TV from an iPad or phone.

The issue is reproducible in an app that does nothing except load up a photo from the main bundle into a UIImageView. It's as if the OS thinks I'm idle and I need to nudge it to remind it I'm still here, but I can find no hints in Apple's documentation as to how I should do this.

Project of trivial app here : https://drive.google.com/file/d/1eY_nQJ7adHEgAvFwhS-t38dqBEPVovub/view?usp=sharing

Answered by pipistrelle in 873792022

Solved. An iOS 2.0 feaure that I assume is being set automatically by SwiftUI.

[[ UIApplication sharedApplication ] setIdleTimerDisabled:true ];
Accepted Answer

Solved. An iOS 2.0 feaure that I assume is being set automatically by SwiftUI.

[[ UIApplication sharedApplication ] setIdleTimerDisabled:true ];
tvOS - how to stop OS from backgrounding my app
 
 
Q