Just locking down a fairly large tvOS project with a lot of synchronised apple tvs. Everything works really well until we try to launch into single-app mode via JAMF. Something seems to block the main thread at startup and it never enters the update / draw cycle. I’ve stripped everything back as much as I can but it still happens.
Interestingly if i remotely kill the app and then restart it (without restarting the device) everything works again, so it appears to be related launching so quickly after boot up.
I can’t attach a debugger because once i’m in single app mode my dev machine stops recognising the device. I understand this is a fairly niche domain but just hoping that someone out there has run into (and subsequently solved) this issue, or at the very least to get some advice on how to debug the managed app.
I’ve managed to “fix” this (i.e to the standards that I need), but just for posterity, the issue was with the display modes changing when the monitor is being woken up from sleep during a reboot. In the apple tv fork of cinder i’m using, the crash would happen when
- (void)screenModeDidChange:(NSNotification *)notification was called in
AppImplCocoaTouch.mm. I suppose when the display is lost, the associated context fails and then no more drawing or updating will happen.
My “solution”, given my specific circumstances, was just to call
exit(-1) when the display mode is changed. Because i’m in a managed environment, this will cause the app to immediately restart but with a more stable display state. Not a great solution, but works for my use case and may prove helpful somewhere down the road for someone dropped into the nightmare that is apple tv development.