简体   繁体   English

加载精灵时出现cocos2d错误

[英]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: 我在XCode控制台中看到了此错误:

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 ? 您在项目导航器中看到了test.png吗? 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). 如果是,请单击它,并确保它已包含在目标中(在“视图”一词的右上角显示实用程序,即这组3个按钮的右键)。 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. Xcode可以时刻关注文件和内容。

Make sure the file is named "test.png" and not "Test.png" because the iOS devices use a case-sensitive filesystem. 确保文件名为“ test.png”而不是“ Test.png”,因为iOS设备使用区分大小写的文件系统。 The file also needs to be added to your Xcode project to the correct target. 该文件也需要添加到Xcode项目中,并指向正确的目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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