I keep getting a crash that says: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'CCSprite: Batched sprites should use the same texture as the batchnode'
I am not quite sure what this means. I googled the crash but got no results. Also this only happens when I go back to my first scene after coming back from the second scene in my game.
I double checked my code and I make sure all the images in my sprite sheets are added as children to the batch node. I also make sure the images in my app that aren't in my sprite sheet are added as a child to my layer and not the batch node.
Anyway what causes this crash and how can I fix it?
Thanks!
Edit1: It seems to be happening on this line in my app:
[self.spriteLeft setDisplayFrame:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:imageName]];
I NSLog imageName and it returns: MyImage.png , then I look in my plist and pvr.ccz that I load and MyImage.png is definitely in there. So I don't know why it is crashing when everything looks right. Also I make sure that I do not use spriteWithFile anywhere where I load an image thats in my sprite sheet.
It simply means what it says : when you create the CCSpriteBatchNode object object with a texture, later when you add sprites to the CCSpriteBatchNode, all the sprites you add to the CCSpriteBatchNode MUST be from the same texture. For example: