Saturn
Saturn

Reputation: 18139

Files removed from Xcode project, but still available in game

My cocos2d-iphone project has tiled maps (.tmx files along with .png textures).

Recently, I deleted all the .png textures in my project (in Xcode, you hit the delete key and then choose to send to trash).

Then, I ran the project, and it tried to load up the CCTMXTiledMap. I was expected it to crash (there shouldn't be any textures in the project, anyway), but it didn't. In fact, it ran just fine, and the maps did load. No idea why - is Xcode keeping some kind of reference to such files somehow?

I checked the .tmx file, and this is the line that defines the source image:

<image source="myMap-hd.png" width="973" height="1024"/>

There definitely is no myMap-hd.png nor myMap.png file in my project folder. Not even Xcode's search toolbar shows it!

Oh, and I also cleaned the project.

Upvotes: 1

Views: 1688

Answers (3)

Collin White
Collin White

Reputation: 670

I've found this to be an issue when nib files are automagically loaded, and while not in the referenced files seem to still be loaded (or attempted). Can cause some brain pain bc the files don't appear in the Xcode IDE though they do exist in the file system.

Upvotes: 0

Johnnywho
Johnnywho

Reputation: 5539

As I wrote in question's comment. Problem was not in your Xcode project. Deleted resource files will most likely be still available on device/simulator if you had run application with these resources previously. The reason is that Xcode doesn't track files that are in application bundle, they're just simply copied. That's why they land in Copy Bundle Resources build phase.

You should delete application from device/simulator and run it again. Or if you have precious data already in application, you could navigate to application bundle and delete file manually. Files won't appear again.

Upvotes: 6

jhilgert00
jhilgert00

Reputation: 5489

In the simulator, iOS Simulator (menu item) > Reset Content and Settings. Clean your project, then run again. Same thing happens without cocos2D.

Upvotes: 2

Related Questions