【发布时间】:2012-03-03 02:59:01
【问题描述】:
我有一个普通的 iOS Cocos2d 游戏。我从 MainMenuViewController 开始,然后在按下“新游戏”按钮时推送我的 rootViewController,然后设置 cocos2d 场景和 HelloWorldLayer。我不确定这些是否相关。
问题是我什么时候想结束我的游戏。当玩家剩下 0 条生命并且检测到某个碰撞时,我希望场景结束,并且我想弹回我的主菜单。所以我在检测到碰撞后立即从我的update: (ccTime) dt 方法中调用以下方法:
-(void)endScene {
[[SimpleAudioEngine sharedEngine] stopBackgroundMusic];
[[CCDirector sharedDirector] end];
[_rootViewController.navigationController popViewControllerAnimated:YES];
}
问题是在结束场景时,我收到各种EXC_BAD_ACCESS 错误。我最常得到的一个是在 CCScheduler.m 中:
// delete all updates that are marked for deletion
// updates with priority < 0
DL_FOREACH_SAFE( updatesNeg, entry, tmp ) {
if(entry->markedForDeletion )
{
[self removeUpdateFromHash:entry]; //THIS IS WHERE IS GET EXC_BAD_ACCESS
}
}
Cocos2d 记录的唯一内容是
2012-03-02 13:36:20.849 Psycho Circles[25265:707] cocos2d: deallocing <CCScheduler: 0x3a3330>
任何帮助将不胜感激!
【问题讨论】:
标签: ios cocos2d-iphone