Breaking News
Home / iOS / iOS Isuses / Can’t create Texture. UIImage is nil in Cocos2D

Can’t create Texture. UIImage is nil in Cocos2D

<!–?xml version=”1.0″ encoding=”UTF-8″?–>

Issue

2012-02-05 23:34:43.968 EngGame[1242:3f03] <0x108d700 Properties.m:(55)> [Properties] in : loadFromUrl(…)

2012-02-05 23:34:43.989 EngGame[1242:707] cocos2d: CCTexture2D. Can’t create Texture. UIImage is nil

2012-02-05 23:34:43.990 EngGame[1242:707] cocos2d: Couldn’t add image:background.png in CCTextureCache

2012-02-05 23:34:43.992 EngGame[1242:707] *** Assertion failure in -[GameLayer addChild:], /workspace/projects/iphone/game/libs/cocos2d/CCNode.m:413

2012-02-05 23:34:43.994 EngGame[1242:707] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Argument must be non-nil’

*** First throw call stack:

Answer

This simply happens when Cocos2D cannot find the image file that is trying to load as a Sprite. So check you project for that image file, most likely it is missing from the project or was added later after the project was compiled. Add the image file in Resources directory, clean and rebuild the project.

[pb_builder]

Check Also

local variable ‘build_data’ referenced before assignment : TestFlight Error : Failed to upload build.

Scenario Trying to upload build to TestFlight fails in the end. Error local variable ‘build_data’ …

Advertisment ad adsense adlogger