BlueVoodoo
BlueVoodoo

Reputation: 3686

Could not load the "" image referenced from a nib

I have no images called "" (nothing). I've gone through the .xib file of the screen where this pops up and can't find anything that would cause this. Anybody who have had the same issue? Here is the full warning:

Could not load the "" image referenced from a nib in the bundle with identifier "com.blah.Blah"

Upvotes: 50

Views: 50872

Answers (21)

everettjf
everettjf

Reputation: 116

Make sure the 'Target Membership' for the 'Assets.xcassets' has been selected.

  1. Click 'Assets.xcassets'
  2. In the 'File inspector', make sure 'Target Membership' selected.

Upvotes: 0

Julian Corrêa
Julian Corrêa

Reputation: 668

Believe or not, sometimes this happens because some IBOutlet was removed and in the storyboard have the reference to it.

Upvotes: 0

Mehul D
Mehul D

Reputation: 140

i also faced same problem because i edited image in photoshop and saved as a psd format make sure you save your edited images in jpg or png format in my case that was the problem hope it helps!!!

Upvotes: 1

Sudheesh
Sudheesh

Reputation: 473

Please do a search for image= shows various results. Select results from nibs or storyboard open it, if there is some value like image="2342D4DF-1E6B-42B8-847A-F9F622921D02" delete it and enjoy.

Upvotes: 1

Avijit Nagare
Avijit Nagare

Reputation: 8782

Initially my image name is "bg" When i found issue, i rename image as "background" but when click on image and hit "Show in Finder"changes was not reflected. image was name as "bg-1.jpg".

so i removed from project convert image to png and drag and drop into project it works for me.

enter image description here

Upvotes: 0

ChikabuZ
ChikabuZ

Reputation: 10185

In my case it was Unknown image in UIBarButtonItem in storyboard.

enter image description here

Upvotes: 3

sp00ky
sp00ky

Reputation: 161

I got this problem for all of my images after switching one of the label's text to 'attributed' and using one of the 'Fun' fonts. Even though I switch it back to 'plain' I still get the "Could not load..." error - until I re-load and re-reference all of my images again.

Upvotes: 0

onmyway133
onmyway133

Reputation: 48085

I'm using Asset Catalog on Xcode 6. Simply removing and re-adding the Asset Catalog fix the problem

Upvotes: 2

Jim Rota
Jim Rota

Reputation: 1781

In my case it was because one of my button images was wrongly added to the Background Image container instead of the Image container (in the Inspector). I found it by going through the entire storyboard hierarchy and checking each image and button setting.

Upvotes: 1

Tommy Devoy
Tommy Devoy

Reputation: 13549

Just for reference, this problem is also caused by using .jpg images and referencing them inside of storyboards/nibs. iOS 8 appears to be able to handle the proper type checking between jpg and png images at runtime. However, on iOS 7 and below you will need to manually set the image in the code and remove the image reference inside of the storyboard to get rid of the warning.

Remember you need to manually set the .jpg when referencing jpg images.

[self.imageView setImage:[UIImage imageNamed:@"yourImage.jpg"]];

Upvotes: 13

Michael E
Michael E

Reputation: 674

I had this warning because of a UITabBarItem. In the attributes inspector for the field "Selected Image" I had a file listed that was also the value for the field "Image". Nevertheless, I received warnings until I made the "Selected Image" field blank.

Upvotes: 15

SonderCode
SonderCode

Reputation: 11

I got this error from an undo action, simply dropping the image back onto the view controller solved the problem.

Atb

Upvotes: 1

Vesuri
Vesuri

Reputation: 369

I had the same issue and in my case there was an UIButton with an invalid image reference in the storyboard file. The reference wasn't empty so it was not trivial to spot by just searching for "" in the storyboard file. However, Xcode did show "Unknown image" for the button in the Background field instead of "Default Background Image". In the storyboard file it appeared as

<state key="normal" title="Use" backgroundImage="0E39AEA8-7F29-40B2-96B1-63B99047E8D5">

so perhaps grepping for backgroundImage and looking for non-familiar references will help find the cause.

Upvotes: 36

RyanTCB
RyanTCB

Reputation: 8224

I came looking for the answer. I searched my entire project and storyboard source code for "" and nowhere could I find it. The clue that the view that is displayed when the error appears is the one you need.

  • Open your xib or storyboard selecting the relevant viewController.

  • On the left click all grey arrows to expand the selection in your view enter image description here

  • look for the UIImageView icon (its the one with the palm tree)

  • select it and open the "Attributes inspector" on the right hand side. enter image description here

  • In the ImageView section at the top in either or both Image and
    Highlighted you will see greyed out "unknown image".

  • Use the drop down menu to change this from "unknown image" and build run

  • voila

Upvotes: 8

Rich
Rich

Reputation: 11

I had a very similiar problem which I eventually found. The line below was causing the problem using the open as source code method mentioned above.

<tabBarItem key="tabBarItem" title="Events" 
            image="319365D1-7058-46CD-8420-18E0EAFB2F29" id="a5a-IF-j9f"/>

Upvotes: 1

imaginethepoet
imaginethepoet

Reputation: 864

In xcode 5.1 I had this same issue. The only way I could finally get it to work when using storyboard was to add the images as an image asset catalog. From what I read maybe they changed something in 5.1. I thought that storyboards don't have nibs - so it would make sense that asset catalog replaces the old method.

Project > General > App Icon Arrow > Import New Folder.

As soon as I did that the NIB references went away and my images showed up.

Upvotes: 2

Tom
Tom

Reputation: 4652

You can do this to check it from your storyboard, or nib. Open it as Source Code:

enter image description here

Then "Find" the image name in it, see if it exists but already invalid in your project, probably you have deleted or changed its name, and now it doesn't seem valid.

enter image description here

Upvotes: 72

ThomasW
ThomasW

Reputation: 17317

The nib (or ultimately the xib) that is the cause of the warning message is the one that is loaded when the message gets written. You then can look at the controls that use images in the inspector and find one where the image name is "Unknown image". You can then clear this value by setting it to some value and then clearing out the value. Note that with UIButton you'll need to try the four different values of "State Config" (Default, Highlighted, Selected & Disabled) to see where the invalid reference might be hiding.

Upvotes: 4

Julio Garcia
Julio Garcia

Reputation: 734

This worked for me:

1- Quit Xcode

2- Make a copy of your .storyboard for backup.

3- Open your .storyboard in a text editor and delete image nodes and image node attributes with empty references.

delete node like this --> <image name=" " .../>
delete image attributes like this --> <tabBarItem key="tabBarItem" title="untitled" image=" " id="6"/>

4- Save the file
5- Open your project again in Xcode.
6- Run Product->Clean
7- Run your project

Warning should be gone.

Upvotes: 1

yglixm
yglixm

Reputation: 121

in my situation, in my xib file,I had ever setup image name for some UIButton and UIImageView ,and delete these image name after sometime, but for unknown reason, these image still apear in the Interface Builder Editer, finally I reset these image name with any image name and delete them again,now problem resolved.

Upvotes: 1

Husrat Mehmood
Husrat Mehmood

Reputation: 2310

Very simple remove the image that is not displaying from you project and then clean the project by going to Product--> clean then once again put the image into your project and done. this worked for me.

Upvotes: 2

Related Questions