I am developing for iPad with Cocos2D 2.0.
I have these lines:
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"atlas.plist"];
CCSpriteBatchNode *batchNode = [CCSpriteBatchNode batchNodeWithFile:@"atlas.png"];
[self addChild:batchNode];
CCSprite *mySprite = [CCSprite spriteWithFrameName:@"white.png"];
it fails miserably with this error:
Cocos2d: CCSpriteFrameCache: Frame ‘white.png’ not found
* Assertion failure in -[CCSprite initWithSpriteFrame:], /Users/myUser/Documents/MyApp/MyApp/libs/cocos2d/CCSprite.m:212**
I have generated the plist using TexturePacker. TexturePacker created 4 files: atlas-ipadhd.plis, atlas-ipadhd.png, atlas.plist and atlas.png.
white-ipadhd.png is a 2×2 white picture. white.png is a 1×1 white picture.
This is the content of atlas-ipadhd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>frames</key>
<dict>
<key>white-ipadhd.png</key>
<dict>
<key>frame</key>
<string>{{162,2},{2,2}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{2,2}}</string>
<key>sourceSize</key>
<string>{2,2}</string>
</dict>
<key>bgNormal-ipadhd.png</key>
<dict>
<key>frame</key>
<string>{{2,2},{348,78}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<true/>
<key>sourceColorRect</key>
<string>{{0,0},{348,78}}</string>
<key>sourceSize</key>
<string>{348,78}</string>
</dict>
<key>bgPressed-ipadhd.png</key>
<dict>
<key>frame</key>
<string>{{82,2},{348,78}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<true/>
<key>sourceColorRect</key>
<string>{{0,0},{348,78}}</string>
<key>sourceSize</key>
<string>{348,78}</string>
</dict>
</dict>
<key>metadata</key>
<dict>
<key>format</key>
<integer>2</integer>
<key>realTextureFileName</key>
<string>atlas-ipadhd.png</string>
<key>size</key>
<string>{256,512}</string>
<key>smartupdate</key>
<string>$TexturePacker:SmartUpdate:f709325b7d140d102cd10dd90ef475b0$</string>
<key>textureFileName</key>
<string>atlas-ipadhd.png</string>
</dict>
</dict>
</plist>
This is atlas.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>frames</key>
<dict>
<key>white.png</key>
<dict>
<key>frame</key>
<string>{{84,2},{1,1}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<false/>
<key>sourceColorRect</key>
<string>{{0,0},{1,1}}</string>
<key>sourceSize</key>
<string>{1,1}</string>
</dict>
<key>bgNormal.png</key>
<dict>
<key>frame</key>
<string>{{2,2},{174,39}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<true/>
<key>sourceColorRect</key>
<string>{{0,0},{174,39}}</string>
<key>sourceSize</key>
<string>{174,39}</string>
</dict>
<key>bgPressed.png</key>
<dict>
<key>frame</key>
<string>{{43,2},{174,39}}</string>
<key>offset</key>
<string>{0,0}</string>
<key>rotated</key>
<true/>
<key>sourceColorRect</key>
<string>{{0,0},{174,39}}</string>
<key>sourceSize</key>
<string>{174,39}</string>
</dict>
</dict>
<key>metadata</key>
<dict>
<key>format</key>
<integer>2</integer>
<key>realTextureFileName</key>
<string>atlas.png</string>
<key>size</key>
<string>{128,256}</string>
<key>smartupdate</key>
<string>$TexturePacker:SmartUpdate:c3c8dd4637d116b049a6b55c8ad175d0$</string>
<key>textureFileName</key>
<string>atlas.png</string>
</dict>
</dict>
</plist>
this is atlas-ipadhd.png and atlas.png


after looking at this for hours, I cannot able to find anything wrong with these files… but it still crashes catastrophically.
any clues? thanks.
the sprite frame name should be white.png in atlas-ipadhd.plist.
straight from the horses’ mouth:
There is no attempt to correct the frame name with device specific keys. This way your code can remain completely device agnostic, you just have to provide the resources (textures and plists) with the appropriate device specific file names.