I’m trying to create a CCSprite from an image on disk. The file is definitely valid image, and I want to display it on a CCLayer. I’m using this code to display the image:
// from a CCLayerColor
CGDataProviderRef imgDataProvider = CGDataProviderCreateWithFilename(@"/documents/pathto/file.jpg");
CGImageRef image = CGImageCreateWithJPEGDataProvider(imgDataProvider, NULL, NO, kCGRenderingIntentDefault);
self.sprite = [CCSprite spriteWithCGImage:image key:@"sprite_frame_01"];
self.sprite.anchorPoint = ccp(0,0);
[self setContentSize:CGSizeMake(100, 100)];
[self addChild:self.sprite];
However, when the scene is rendered I see this (The CCSprite is the numbers with the white background around it):

This happens no matter what image use. Is there something else I need to do?
The problem was that cocos2d was auto-appending
-ipadto the image filename, which didn’t exist since it was from the camera roll. I fixed it using[[CCFileUtils sharedFileUtils] setiPadSuffix:@""];.I don’t have any specific iPad or retina specific files in my app, but for those that do, abica wrote an excellent method on the cocos2d forums which shows how to handle this on a per-file basis.