0

Errors I'm getting:

Cocos2d: Get data from file(res/Teapot.png) failed!
Cocos2d: ERROR: SpriteFrame NULL

Not sure what's going on when using the image path from CocosBuilder. I've uploaded my iOS project on github, along with the CocosBuilder project. As you can see on the device the label shows up fine, but it is missing the teapot.

CocosBuilder Screenshot CocosBuilder Screenshot

Device Screenshot

Device Screenshot

docchang
  • 1,115
  • 15
  • 32

2 Answers2

0

It's not finding the "Teapot.png" file path.

Try to use this when loading the CCSprite:

NSString* path = [[NSBundle mainBundle] pathForResource:@"Teapot" ofType:@"png" inDirectory:@"res"];

CCSprite *mySprite = [CCSprite spriteWithFile:path];

or

NSString* path = [[NSBundle mainBundle] pathForResource:@"Teapot" ofType:@"png"];
Magrones
  • 413
  • 2
  • 9
  • Sir, the image path is configured in CocosBuilder, I do not manually add it in. In addition, this is a Cocos2d-x project, using device specifics are discouraged. – docchang Jul 03 '13 at 23:12
0

When adding the published resources into xcode, you may select the "create folder references for any added folders", that is, after the resources added the color of sub-folders('res' in this case) will be blue instead of yellow.

Nianliang
  • 2,926
  • 3
  • 29
  • 22