21

I've created a static library and a resource bundle for reusing code and assets across several projects.

Within the static library, I have a manager class whose sole purpose is to create other UIViewControllers, whose views are created from .xib files (using the common initWithNibName:bundle: method).

When I create the view in Interface Builder, the images show correctly. However, when I run the app on the simulator, I get this error:

    Could not load the "<image_name.png>" image referenced from a nib in the 
    bundle with identifier "com.<my_company>.<app_identifer>"

After hours of grinding, I finally inspected the resources bundle, and I found that the .png files weren't in it! Instead, .tiff files of the same name (excluding @2x versions) were there instead.

All of the images are included within the bundle's build phase under copy bundle resources , and I've used the images on other iOS projects (so they're not corrupted).

Has anyone else experienced this? Is it safe to assume that the images will always be added to the bundle as .tiff? (And if so, is it safe to just change the image name in interface builder to .tiff?) Or am I doing something incorrect here?

Thanks for your help in advance.

JRG-Developer
  • 12,454
  • 8
  • 55
  • 81

2 Answers2

22

For the issue of resource bundles , refer to this link as it has a couple of similar faced queries.

Conversion Resource bundle

Tell me which answer really helped you solve this issue. Thanks.

Community
  • 1
  • 1
IronManGill
  • 7,222
  • 2
  • 31
  • 52
  • 6
    The second answer and the comment on the third answer really helped solve this issue for me. Basically, because bundles are created in iOS using a "hack" (modifying a Mac OSX bundle), some settings need to be changed to make everything work -- in this instance, this was changing the "combine high resolution artwork" option to "No". Thanks Gill! – JRG-Developer Sep 24 '12 at 08:13
  • Awesome. When will we get a legitimate bundle resource for iOS? – MattD Feb 04 '15 at 22:14
18

This Solved my problem

In your bundle target Go to,

Build Settings > COMBINE_HIDPI_IMAGES and set to NO

Community
  • 1
  • 1
Mohammad Zaid Pathan
  • 16,304
  • 7
  • 99
  • 130