[Solved - XCode project settings were wrong] CCSprite/CCFileUtils not reading sprite image

Hello guys,

Well, i’m “porting” my game to iOS, but i’m having this strange problem with sprites not loading… The game runs smoothly on android devices, so the error must be related to something wrong in my xcode project.
I’ve “created” the xcode project by coping the “SimpleGame” project inside samples folder. Then i’ve renamed it and added the resources and source files. It compiles with no errors (just some warnings as shown by screenshot), but when the game tries to create a sprite using CCSprite::create(spritePath) it simply returns null and the game crashes when trying to set the position of the not loaded sprite…
I’ve tried to recreate the project, with no success…

Please, take a look at the screenshots and see if you can find what’s wrong…i’ve lost almos a week of work trying to run this… if anyone needs more info, jut ask

Thanks in advance!

Screenshots:
https://docs.google.com/file/d/0B94sVpuHml_tWGUyUmZJQWF4RTQ/edit?usp=sharing
https://docs.google.com/file/d/0B94sVpuHml_tRkR2SVNtRUNINnM/edit?usp=sharing
https://docs.google.com/file/d/0B94sVpuHml_tVW5jTkJWbUZHSlk/edit?usp=sharing
https://docs.google.com/file/d/0B94sVpuHml_tREtHNUx1Ykw0Qmc/edit?usp=sharing
https://docs.google.com/file/d/0B94sVpuHml_tY24zU0ZMQ1RqVlk/edit?usp=sharing
https://docs.google.com/file/d/0B94sVpuHml_tU01IVk1tSTFkQms/edit?usp=sharing

What version are you using?

Lance Gray wrote:

What version are you using?

cocos2d-2.1beta3-x-2.1.0

Maybe your png files are not in the correct directory or something like that.

Leszek Leszek wrote:

Maybe your png files are not in the correct directory or something like that.

Ok, I finally had the thought of changing the path for loading the image. For my surprise, for some reason, XCode is not letting images inside their folders (eg “Folder/Image.png”), but is compiling the project with every image inside root (eg “Image.png”).
Well, how do I force xcode to compile the resources inside their directories?

Guilherme Maia wrote:

Leszek Leszek wrote:
> Maybe your png files are not in the correct directory or something like that.
>
Ok, I finally had the thought of changing the path for loading the image. For my surprise, for some reason, XCode is not letting images inside their folders (eg “Folder/Image.png”), but is compiling the project with every image inside root (eg “Image.png”).
Well, how do I force xcode to compile the resources inside their directories?

I found with a simple google search: http://stackoverflow.com/questions/5720478/store-folders-in-package-contents-bundle-resources-in-xcode-4-0

thanks guys, this problem is solved now ;D

I think this might be one of the most asked question on this forum.
I had the same issue myself when I started supporting multi resolutions.

Maybe a warning should be added to AppDelegate?

add files to “…”

choose “Create groups for any added folders”