开发者

how can I solve mPeakPower issue

I开发者_运维知识库 have 2 issues

1) when I run the code it will give me exc_bad_access in this line

Float32 peak = levels[0].mPeakPower;

2) when I run an animation it will give me this error and after that, the App crashes:

cocos2d: CCTexture2D. Can't create Texture. `UIImage` is nil
2011-08-02 12:38:14.921 AnimBear[596:207] cocos2d: Couldn't add
image:face.plist in CCTextureCache

How can I solve this?


Your levels array is likely nil or empty (the access to item 0 is causing the exception). You might log [levels count] ahead of that line to confirm the length of the array.

NSLog(@"Levels count: %d", [levels count]);

For the second part of the question, face.plist is not an image. Typically loading a sprite using a texture cache looks like:

CCTexture2D *texture = [[CCTextureCache sharedTextureCache] addImage:imageName];
CCSprite *sprite = [CCSprite spriteWithTexture:texture];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜