Could not load the image referenced from a nib in the bundle with identifier

24,196

Solution 1

The issue has been rectified. Problem was with the image format. When the image has been edited and saved as PNG-24 everything goes fine. The application now runs smoothly in simulator and device.

Thanks for all friends who suggested a solution and tried to helped me.

Regards, Rupesh R Menon

Solution 2

I know it's very late, but this is a solution that also works in Xcode 5, and therefore likely to be useful to people who have this problem in the future.

I have seen a lot of questions like this on the web but none of them seems to have one clear answer. This is, as far as I know, the solution for this problem:

  • Go to the image in Xcode (no need to re-add or re-generate the image)
  • click "show the file inspector"
  • Make sure the checkbox in the category "Target Membership" is checked. the test check box does not have to be checked to make your app load the image.

The target membership tab looks like this:

enter image description here

if this is already the case, you are working with a broken or damaged file. to rule this out, check if another app (like photoshop) can open your image.

This should do it, hope it helps!

Solution 3

When dragging your start.png file into your project, did you check this option?

alt text

Solution 4

I was getting this error in the simulator after upgrading to Xcode 7 / iOS 9 and opening an existing project. The image was present and named correctly, within an XCAssets package.

Turns out the problem was with a parameter within the XCAssets package.

Changing Render As from Default to Original Image solved the problem:

enter image description here

Solution 5

I've had the same problem before. The png file format is not right. Try re-generate the png image file and the problem will be solved.

Share:
24,196
Rupesh R Menon
Author by

Rupesh R Menon

Job Profile: Working as iPhone/iPad Developer at Feathersoft Info Solutions Pvt. Ltd. Cochin from 8th March 2010. Educational Qualification: MSc Computer Science from MG University . BCA from MG University.

Updated on December 22, 2020

Comments

  • Rupesh R Menon
    Rupesh R Menon over 3 years

    I had got an iPad application.The ViewContrtoller.xib has got an UIImageView in it. The UIImage of the UIImageView is set through Interface Builder. When I run the application in simulator everything is fine. But when I am trying to run it in iPad the UIImage is not loaded. The message that I am getting is:

    HexaPuzzle1.0[3259:207] Could not load the "start.png" image referenced from a nib in the bundle with identifier "com.yourcompany.HexaPuzzle1-0" 2010-12-17 10:57:27.221 HexaPuzzle1.0[3259:207] HexaPuzzle loaded

    Any help would be appreciated and will be a great help for me.

  • Rupesh R Menon
    Rupesh R Menon over 13 years
    Hi, Thanks for the interest taken. You mean to add to the image to target? It's already there.
  • Rupesh R Menon
    Rupesh R Menon over 13 years
    This has already done. Image is already copied to destination group's folder and it is also there in target. I think some other issue. Any way thanks for your suggestion.
  • Kenny Wyland
    Kenny Wyland over 13 years
    I was having the same problem and this worked for me. Apparently something went wrong the first time I saved the png. I resaved it to a different filename and then renamed it. It is working now. Thanks!
  • Bagusflyer
    Bagusflyer over 11 years
    The problem for me I don't have a image file with that name. And I don't use that file in my nib file at all. How can I find which file is using this image file?
  • Rui Lopes
    Rui Lopes about 11 years
    In my case, the problem was that the @2x image had a diferente name: a non-capitalized letter.
  • Joris416
    Joris416 over 10 years
    glad to help! happy coding!
  • Anupama
    Anupama about 10 years
    @Imagine digital i click on show in inspector the image is not opened please tell me the solution
  • Joris416
    Joris416 about 10 years
    Make sure the image is selected in the navigator when you click the "show file inspector" tab. once you have clicked that tab, make sure you check the checkbox named "Target Membership"
  • Steve
    Steve almost 10 years
    There is no "Target Membership" category in the inspector when I have an image selected.
  • Steve
    Steve almost 10 years
    Thanks @Imaginedigital. My images are in one of those pesky blue folders. Not sure if that has anything to do with the images not loading for me.
  • Joris416
    Joris416 almost 10 years
    You may want to select the blue folder and make sure the "Target Membership" is selected for that. If not, try to add the images separately instead of the entire folder.
  • Paul Brewczynski
    Paul Brewczynski over 9 years
    I've put the jpg image to the Images.xcassets. And it worked in simulator but not on the device. Does it mean that iOS doesn't handle jpg images ?
  • campsjos
    campsjos about 9 years
    I've solved it editing all my JPG images and saving them in PNG-24 but I'm sure that it have to be any way to load JPG images. In this Google Group some people say that is enough to add the .jpg extension in the Interface Buider and in Images.xcassets but it didn't work for me...
  • tsr
    tsr over 8 years
    I had the same issue, but I'm not sure what is the root cause. Do you know why "Default" doesn't work?
  • jt_uk
    jt_uk over 8 years
    No @tsr, I haven't had chance to check yet. I did notice that some "Default" images in the project already weren't affected, but I haven't spotted the pattern yet.
  • David Cruz
    David Cruz over 8 years
    Solved the problem. ;)