Crash if backgrounding cocos2d 2.1 app in iOS7 while watching Game Center screens (leaderboard, achievement)

此生再无相见时 提交于 2019-12-03 12:43:21

Good Call. I ran into the same issue as you do and your post helped me to figure out how my app crashed.

So my solution is stop director animation before showing game center.

[[CCDirector sharedDirector] stopAnimation]
[[CCDirector sharedDirector] presentViewController:gcViewController animated:YES completion:nil];

Then restart animation in the game center view dismiss callback

- (void) gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController
{
    [[CCDirector sharedDirector] dismissViewControllerAnimated:YES completion:nil];
    [[CCDirector sharedDirector] startAnimation];
}

Your updated solution should work, but same here, I am not sure if there would be any side effects. I guess it is a safer approach to just wrap around the game center itself.

Thanks again for posting this question!

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