iOS resouce problem

I have an issue, and I think it’s a resource problem.
When I run project on Xcode, it looks like this:


Then I stop and run again, it change into this:

But on Android, it works well:

You can see my code on Github:
https://github.com/hungnv24/LoveChasing

I downloaded your code and tried it in the iPhone Retina 3.5" simulator and I get this:

The problem with the boy animation is that you’re manually creating the sprite frames from the sprite sheet, but the Rect you pass does not compensate for your three different resolutions.

I set design resolution, they works well on android. And not only boy sprite sheet, other resources seems has been loaded wrong.

Have you tested it on different screen resolution on Android? Ones that fall into your small, medium and large buckets?

I ask, because when run on the non-Retina iPhone simulator, the boy animation looks fine. So I assume the “small” category is what it’s calibrated to.

I see what @toojuice is saying. Have you read through: http://www.cocos2d-x.org/wiki/Multi_resolution_support

I tested on 3 types of android devices size. There’s no problem.
I made plenty of game on android with cocos, but this is the first time a work with iOS.
Everytime a press run on Xcode, it uses another resource. I don’t understand that. If there’s anything wrong with resource, they should be on Android too.

Maybe you need to remove your DerivedData folder

I deleted it, then I tested on iPad (non-retina) simulator, but it still doesn’t work. Is there anything wrong in my code or my Xcode?

well, I do things, sort of like you, when checking screen size, design resolution, etc. If I run your game it surely does what you describe. I’d check out the different resolution policies.

1 Like

Thank you! I checked them out, too. Did you get any luck?

EDIT

I completely erased my previous answer, because I found the real cause of the problem.

In Xcode, the Resource directories “large/images”, “medium/images”, “small/images” were added as groups. I think this doesn’t work, because internally, it can’t tell the difference between groups. So all the images have the same name, and the last one added to the project effectively overwrote the others.

To fix:

  1. In Xcode - in the left hand panel, select the three groups “large”, “medium”, “small”
  2. Press delete
  3. IMPORTANT: in the pop up alert, press “Remove Reference” – if you choose “Move to Trash”, it will send all your images to the trash bin and they will not be in your folder any more
  4. from Finder, select those three folders and drag them to the Resources group in Xcode
  5. In the popup window, unselect the option Copy items into destination group’s folder (if needed) and choose Create folder references for any added folders – the second one is the important one here

The three image folders should now show up under the Resources group, but in blue instead of yellow… that’s how you know it worked.

1 Like

Thank you very much! Now it’s perfect. You saved my day.

@toojuice - Nice catch. I forget that things aren’t references by default.