tvOS GameController At what point does GCController.controllers become populated after app launch?

I'm trying to read the

GCController.controllers()
array after my app has launched to know which controllers were already connected to the AppleTV at app launch. But
GCController.controllers().count
is 0 until some point after
viewDidAppear
gets called on my initial UIViewController. Does anyone know the definitive point by which you can check
GCController.controllers()
to know that it has been populated with the currently connected controllers?

Replies

Hi geoffheatley,


Thanks for reaching out. GCController.controllers gets populated after applicationDidFinishLaunching. This lets you register for GCControllerDidConnect and GCControllerDidDisconnect with NSNotificationCenter inside applicationDidFinishLaunching or at any eariler point and be sure all controllers will notify you.


Cheers