Can't load CCSpriteBatchNode using cocos2d when compiling in release mode

82 Views Asked by At

Following is part of my program:

CCSpriteFrameCache *frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
NSString *plistFileName = [NSString stringWithFormat:@"%@%@", aName, @".plist"];
NSString *pngFileName = [NSString stringWithFormat:@"%@%@", aName, @".png"];

[frameCache addSpriteFramesWithFile:plistFileName textureFilename:pngFileName];
self.sprite = [CCSprite spriteWithSpriteFrameName:@"bandit_standby_1"];
self.batchNode = [CCSpriteBatchNode batchNodeWithFile:pngFileName];

The problem occurs in the last line:

self.batchNode = [CCSpriteBatchNode batchNodeWithFile:pngFileName];

When compiling in debug mode, nothing is wrong.

However, after changing mode to release, an error occurs:

ImageIO: CGImageSourceCreateWithData data parameter is nil

Can anyone tell me where is wrong?

0

There are 0 best solutions below