cocos2d/cocos2d-iphone — pull request #946 by sridenour (2014-08-21 21:00:04+00:00)
Title: Always stop CCDirector when app is backgrounded

With the way things currently are, the CCDirector will keep trying to render the scene if it isn't the "visible" view controller when the app gets backgrounded, leading to a crash. Such scenarios include the user being shown the GameCenter login screen and switching away from the app to look up their password in 1Password, or if the user is being shown a Tweet Sheet and switches away.

In my own game the user can send a tweet to share their game progress, and if they switch away while the Tweet Sheet (`SLComposeViewController`) is being shown (such as getting a phone call) the game will crash. My code **does** call `[[CCDirector sharedDirector] pause]` when it shows the tweet sheet so that the tweet sheet's appearance animation is smooth, but I had (incorrectly) assumed that CCAppDelegate would call `-stopAnimation` on the CCDirector if the user switched away.

I don't see a reason for CCAppDelegate to *not* stop the CCDirector, hence this pull request.