cocos2d removeAllChildrenWithCleanup崩溃

时间:2012-10-02 16:37:11

标签: iphone cocos2d-iphone

我正在开发一个iphone应用程序,我从CCMenu中删除所有项目时遇到问题。问题是当调用CCMenuItem的选择器时,我删除触发选择器的项目并且应用程序崩溃。

代码(在CCLayer中):

 -(void) clearAll
 {
    [popupMenu removeAllChildrenWithCleanup:YES];
 }
 -(void) onButtonClick:(id) sender
 {
    [self clearAll];
 }
 -(void) createButtons
 {
      CCMenuItemImage * menuItem = [CCMenuItemImage itemFromNormalImage:@"back_button.png" selectedImage:@"back_button.png" target:self selector:@selector(onButtonClick:)]; 
      [popupMenu addChild: menuItem];
 }           

有谁知道应用程序崩溃的原因以及如何解决此问题?

由于

更新:

崩溃邮件堆栈跟踪:

 0x01abaabc in __NSI3 ()
 0x01a9f495 in -[NSInvocation invoke] ()
 0x0006852f in -[CCMenuItem activate] at /***/cocos2d/CCMenuItem.m:128
 0x00068d80 in -[CCMenuItemLabel activate] at /***/cocos2d/CCMenuItem.m:222
 0x00065c24 in -[CCMenu ccTouchEnded:withEvent:] at /***/cocos2d/CCMenu.m:196
 0x01b3ae99 in -[NSObject performSelector:withObject:withObject:] ()
 0x000bb44d in -[CCTouchDispatcher touches:withEvent:withTouchType:] at /***/cocos2d/Platforms/iOS/CCTouchDispatcher.m:268
 0x000bbfa3 in -[CCTouchDispatcher touchesEnded:withEvent:] at /***/cocos2d/Platforms/iOS/CCTouchDispatcher.m:337
 0x000bdd5e in -[EAGLView touchesEnded:withEvent:] at /***/cocos2d/Platforms/iOS/EAGLView.m:330
 0x009d63c0 in -[UIWindow _sendTouchesForEvent:] ()
 0x009d65e6 in -[UIWindow sendEvent:] ()
 0x009bcdc4 in -[UIApplication sendEvent:] ()
 0x009b0634 in _UIApplicationHandleEvent ()
 0x03589ef5 in PurpleEventCallback ()

0 个答案:

没有答案