简体   繁体   中英

cocos2d error while loading sprite

I am having a quite strange problem in loading a sprite that was previously correctly loaded. I get this error depicted in the XCode console:

CCTexture2D. Can't create Texture. UIImage is nil
Couldn't add image:test.png in CCTextureCache

I can not see what is changed any advice?

Do you see test.png in the project navigator ? If yes, click on it, and make certain it is included in the target (show Utilities, at the top right, above the word 'view', the right button of that group of 3 buttons). Make certain that in the pane 'Target membership', your build target is selected. If not, well... you know what to do.

Also, as a 'personal rule', before trying anything when this sort of thing occurs, i tend to clean the target (including the project derived data), then a build and test again. Xcode can have its moments with respect to keeping track of files and stuff.

Make sure the file is named "test.png" and not "Test.png" because the iOS devices use a case-sensitive filesystem. The file also needs to be added to your Xcode project to the correct target.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM