cocos2d-x game crashes when entered background

[亡魂溺海] 提交于 2019-12-01 05:47:06

The app delegate method applicationDidEnterBackground: is called after your application transitions to the background, but before your application is suspended. Unfortunately, you may not perform any GPU instructions while in the background, or the watchdog will terminate you (as you're seeing here).

Assuming that your CCDirector::sharedDirector()->pause() call is responsible for stoping your graphics/animation loop, you should move that to the applicationWillResignActive: delegate method. That method is called before your application transitions to the background.

However you have your code structured, make sure your animation loop is completely flushed and stopped before you return from the applicationWillResignActive: delegate call.

Note: This answer is in reference to why it always crashes on iOS

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!