我试图在游戏中的不同场景之间切换。我从GameLayer切换到Config场景第一个,然后使用以下代码切换回来,但游戏崩溃了:
-(void) backToGame
{
[[CCDirector sharedDirector] replaceScene:[GameLayer scene]];
}
我收到的日志:
thread #1: tid = 0x1c03, 0x350ebf78 libobjc.A.dylib`objc_msgSend + 16, stop reason = EXC_BAD_ACCESS (code=1, address=0xe0000008)
frame #0: 0x350ebf78 libobjc.A.dylib`objc_msgSend + 16
frame #1: 0x373352e6 CoreFoundation`CFRelease + 94
frame #2: 0x373b1b36 CoreFoundation`__CFDictionaryStandardReleaseValue + 70
frame #3: 0x374053bc CoreFoundation`__CFBasicHashDrain + 264
frame #4: 0x3733539a CoreFoundation`CFRelease + 274
frame #5: 0x350eee56 libobjc.A.dylib`objc_release + 38
(lldb)
很抱歉,我无法在项目中添加任何代码,因为我真的不知道它来自哪里。
感谢您的帮助。
答案 0 :(得分:0)
试试这行代码。
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[GameLayer scene] withColor:ccWHITE]];