Resolved "Could not load image referenced from a nib in bundle" - file is in bundle under the exact same name

Discussion in 'iOS Programming' started by moonman239, Aug 26, 2015.

  1. moonman239, Aug 26, 2015
    Last edited: Aug 26, 2015

    moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
    #1
    I have an image called Play button.png in my app's bundle. It shows up just fine in Interface Builder, but it's not there when I run it on my device. I'm beginning to think I'm breaking a file naming convention or two. Am I right?

    Edit: I renamed it to play-button.png & pointed the button in my app to the correct image, and the device still gives me the same error message (of course, with a different file name mentioned)

    Edit #2: According to SIPS, this PNG has 8 bits per sample, and 4 samples per pixel.
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    It's best not to have spaces in file names. The file system on the device is case sensitive while the file system on your Mac most likely is case insensitive. Are you using an @2x version of the file? Are you using Images.xcassets to store your images? Does the image load on the Sim?

    Various things to try: option-clean your project. Remove the app from the device. After you build open the bundle on your Mac to see if the file is there. You can also download the bundle from the device and see if the file is there. Can you load the image with UIImage imageNamed: ?
     
  3. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #3
    Thanks for the suggestions.

    I don't have a @2x version - one version for use with all devices (TBH, though, I don't believe users are exactly going to care). Also, I'm not using Images.xcassets, and I haven't tried the simulator. I removed the spaces and turned the upper-case P into a lowercase P.
     
  4. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #4
    OK, so I managed to get around this issue by setting the UIButton image programmatically.

    Edit: Once again, thank you PhoneyDeveloper.
     

Share This Page