我有一個CCMenu的Cocos2d場景(CCLayer)。我實現的dealloc作爲cocos2d場景dealloc
- (void) dealloc {
[menu release];
menu = nil;
[super dealloc];
}
當我使用共享主任與其他更換的場景,它加載的dealloc第二場景,然後程序崩潰,尤其是在
[super dealloc]; //Thread1: Program received signal: "EXC_BAD_ACCESS".
調用替換現場是
[[CCDirector sharedDirector] replaceScene:
[CCTransitionFade transitionWithDuration:0.5f scene:[SomeOtherScene scene]]];
爲什麼會發生這種情況?我應該叫[super dealloc]還是不?
你應該真的在新項目中使用ARC。以下是如何爲cocos2d啓用它:http://www.learn-cocos2d.com/2012/04/enabling-arc-cocos2d-project-howto-stepbystep-tutorialguide/ – LearnCocos2D