I use Cocos2D to write a game for iOS. I implemented a pause function that allows the user to pause on demand. When I receive applicationWillResignActive I also pause completely (non-urgent main game loop). On applicationWillEnterForeground and applicationDidBecomeActive I resume the main game loop, but then drop the player into the pause menu, forcing them to resume when they are ready. Everything seems to work well, except in one situation. Upon receipt of a calendar alarm (which I assume is UIAlert), the game does not pause or pause the game.
My three questions are: should I include both willEnterForeground and didBecomeActive , or is one of them good enough for my purposes? What call should I plan to receive UIAlerts (if this is really what causes my error in the above case) and how do I handle them? Is there a way to simulate a UIAlert so that I can test / debug?
Great importance.
Edit -
The problem was my general handling of these events. As indicated in the documentation for the apple, use willResignActive to pause the game (i.e., start the pause menu and stop the game loop) and didEnterForeground to resume the game cycle, but keep the pause menu up. Thus, by managing events, there was no need to plan to receive UIAlerts or local / remote notifications.
source share