Cocos 2D v1.0.1 : Crash at changing CCMenuItemImage normal image
- by Max
I retrieve a crash log file, which, after XCode analysis on my archive show the problematic line of code :
Date/Time: 2012-12-08 23:48:08.930 +0100
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x31a4088f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x3188b259 objc_exception_throw + 33
2 CoreFoundation 0x31a40789 +[NSException raise:format:] + 1
3 Foundation 0x374c73a3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 91
4 Killer 0x0017ed35 -[CCSprite initWithFile:] (CCSprite.m:201)
5 Killer 0x0017e419 +[CCSprite spriteWithFile:] (CCSprite.m:93)
6 Killer 0x00123101 -[Player makeZombie] (Player.m:1363)
7 Killer 0x00105a51 -[PlayScene endOfKilling:] (PlayScene.m:1438)
Which clearly indicates the second of the two following lines is crashing:
NSLog(@"images %@ %@",self.zombieImage,self.zombieImageDown);
[self.characterSprite setNormalImage:[CCSprite spriteWithFile:self.zombieImage]];
I know that the crash seem to happend when the user is touching the corresponding CCMeanuItemImage, is there a problem if the user is touching it, while we change the normal et selected images of it ? Is this the right manner to change its image (i do it several times during the game) ?
Thanks for your ideas