1

I am trying to switch between different scenes in my game. I switched from my GameLayer to a Config scene first, then switch back using the following code, but the game crashes:

-(void) backToGame
{
    [[CCDirector sharedDirector] replaceScene:[GameLayer scene]];
}

And the log I received:

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) 

I am sorry that I cannot attach any more codes from my project because I really don't know where it comes from.

Thanks for your help.

zeroliu
  • 990
  • 2
  • 10
  • 15

1 Answers1

0

Try this lines of code.

[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[GameLayer scene] withColor:ccWHITE]];
Guru
  • 21,652
  • 10
  • 63
  • 102
  • Thanks for the response, but I have found and solved the pbm by using NSZombie. It is some other stuffs in my code. – zeroliu Nov 17 '12 at 09:36