Apple TV App not exiting to the home screen from initial view controller when menu button pressed on remote.

I've just had an Apple TV app rejected because of


'In addition, the Menu button on the Siri Remote does not behave as expected in your app.

Specifically, when the user launches the app and taps the Menu button on the Siri Remote, the app does not exit to the Apple TV Home screen.'


I'm looking this up and from what I can tell this should be the automatic behaviour of pressing the menu button when on the initial view controller. However I have a navigation controller with a root view controller, instantiated automatically via the storyboard with no methods overridden and nothing happens when I press the menu button on this view controller.


Can someone tell me if I'm missing something or if there's a way of implementing this manually?


I'm thinking I could just intercept the menu button press and call exit(0), but that doesn't seem like a graceful way of exiting.

This should be handled for you automatically, as long as your app isn't doing anything to prevent the default behavior.


You should check to see if you have any gesture recognizers that are listening for the menu button: if those gestures recognize, they'll prevent the default app-exit behavior from happening.


Also, if you're overridding pressesEnded on any of your views or view controllers, make sure that if you don't handle the event that you call super, otherwise you could prevent the app exit.

I wanted to reply this as I received a second rejection for this issue (after applying the specified above fix). This failure has a very specific set of conditions that are not solved by calling [super pressesEnded ....] in your view controllers override of pressesEnded.


The condition:

App not installed on Apple TV.

Install App.

Start App.

Press Menu Button on remote.

*Note: Do not interact in any way with your app

*Note: pressesBegan and pressesEnded both overrode in view controler

*Note: SpriteKit Game with single view controller and multiple scenes


If you do anything else before that Menu Button press then the app would exit properly with the [super pressesEnded ...] added in the override function in the view controller. To fix this one specific situation you also have to call [super pressesBegan ....] in your override function in the view controller. For some reason I cannot identify the app state is such after startup and before any user action that exit to main menu is processed in the pressesBegan function inside the super and not the pressesEnded function as it is the rest of the time.


Update: I could also trigger this problem if I exited the app in the multi-tasking display (double tap home -> select app -> swipe up) and then started the app. what I find odd is that starting a new debug session from XCode is NOT the same as exiting the app or deleting the app. This has made this rejection hard to trouble shoot.


For those asking why I override both pressesBegin and pressesEnd is because the app is a game and there is a delay between pressesBegan and pressesEnded that was noticable in reaction speed of button presses. I had to override pressesEnded and call the super or scene switcher to allow for proper scene switching and exiting with SpriteKit.


TLDR: If you override pressesBegan and/or pressesEnded you should call the proper super function for all presses that you do not handle and when at the main menu of your game you must call them for the menu button so that app exits properly.

I had the same rejection and implemented the same fixes as you have.


The only thing I have to add is that in a game, pressing Menu during the game should either show an options menu, or take you to the game's main screen. (Per the HIG)

just got rejected for MENU as well. was handling only pressesBegan and it seemed to work well while I was testing at home. Did pressesEnded now as well and will submit once more. thanks for your post.

Hi Justin, what if I have an entry view controller (first view to appear) as a LOGIN PAGE for my app. After a successful login the user is redirected to a second view controller (MAIN PAGE). Then, since the user is logged in, if I press the Menu button on the remote from the MAIN PAGE I want to exit the app instead to go back to the LOGIN PAGE. My app has been already rejected for this reason, and I can find a valid solution to this probelm. Please advice. Best regards.

Hey, hi my app got rejected for same issue! So, can i over ride press began to goto home from app?

is that good way or they will reject again if i use press began?

Try addin this on the ViewDidLoad of the MAIN page:


UIApplication.sharedApplication().keyWindow?.rootViewController = self


This will change the root viewcontroller of your app to your MAIN page and cause it to exit the app if you press the menu button.

Apple TV App not exiting to the home screen from initial view controller when menu button pressed on remote.
 
 
Q