setResourceDirectory and IOS 6 simulator in xcode

Hi,

I’m writing a cross platform game using 2.0.3 currently.
I’m using the setResourceDirectory code to set the folder that contains the correctly sized resources.

For ios devices I’m just setting the folder.
For android I’m also setting the designed resolution.

When I deploy to my android device it works correctly.
When I’m using the xcode ios sumulator (6.0) i get funny results.

Each time I run the project, even though its going through the correct setResourceDirectory call it seems to pick a different folder.

I have modified the .png files in the folders to have a drawn on identifier, I can see that the simulator picks a different image so its not just a sizing issue.
My splash screen has 3 or 4 sprites, it even looks like different sprites are getting their png from different folders.
Background might come from hd, close button from sd and start from ipadhd.

As I mentioned, the android deploy works ok.

It this a problem with my code, cocos2dx or xcode / ios simulator?
I dont have a IOS developer account so cant test this on a actiual device yet.

Thanks

Edam.

I suppose I’m going to have to dig in the code and see where its loading the asset.
I’m using SpriteHelper and LevelHelper, could it be a problem with those apps?

I know the LevelHelper app you get from the app store does not support the new resource folder stuff.
I believe its waiting for approval from apple.

SpriteHelper is creating the correct sprite sheet files in the correct folder so its either LevelHelper doing something funny, the cocos2dx code for ios or the xcode ios simulator.

I have another question, I have a sub folder in my resources folder called levels, on android I have to add the folder name to load the asset (i.e. levels/level1.plhs), on IOS it only works if I don’t add the folder name.
Is this down to the way I added the folder to xcode (i.e. as as group)?
Should I have added files and selected the folder?

Thanks

I also had this problem.

cocos2d-x is checking the folder under the simulator, i.e.:

/Users//Library/Application Support/iPhone Simulator/6.0/Applications///

Only, because Apple uses virtual paths, all the resources are copied to the root of this folder. So if you have multiple resources of the same name, which the setResourceDirectory method requires, when xcode deploys to the simulator it will copy one file and then copy the second over the first.

The solution is to remove the folder referenced by setResourceDirectory from the project and re-add it; but when you add the resources select: “Create folder references for any added folders”.

This will create the folders under the path:

/Users//Library/Application Support/iPhone Simulator/6.0/Applications///

Allowing cocos2d-x to query their existence.

This is not a bug in cocos2d-x, it is the result of Apple’s choice to use a virtual folder structure. This is not the first time I’ve wasted a good hour directly due to this design decision.

I’d recommend that the maintainers of http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Mechanism_of_loading_resources add a note to direct xcode users to select “Create folder references for any added folders” to minimise the impact of this issue on the xcode community.

Cheers.

Thanks, that was exactly the problem.

Its now picking the correct images.

I had the same problem, damn xcode!

This have resolved the problem, thank you