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

IosIphone

Ios Problem Overview


when I load my application it shows a warning message that

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

I searched and confirmed all my images. But it still shows that warning.

Ios Solutions


Solution 1 - Ios

  1. Select your image(s) in Project Navigator.
  2. Open the File Inspector.
  3. Make sure you have the target selected.

Add your image to the target

Solution 2 - Ios

I had the same issue when I Refactor to Storyboard. Apparently the Asset catalog does not transfer the image reference. To fix, see below:

You would notice that your ImageViews is empty from reference.

Image Views

> 1 - Click on the ImageView

Click the Image View

> 2 Go to the Utilities bar where you would see you asset image is unknown

Unknow Image

> 3 - Change it back to you image asset

Choose your image again

This should fix your error. Hope this helps!

Solution 3 - Ios

There might be many reasons of this error. To fix this issue you can just follow below given step:

  1. Go to product menu of the Xcode, select clean.
  2. If still you are getting the error, then remove the images from your project and again add the images to your project.
  3. while adding image into the project, make sure that you have selected the Project name inside the "Add to targets". And also enable the "Copy items if needed".

Please Refer below image for better understanding:

First Image convey that while uploading image the TestTests is enable under Add to targets

Due to the above process we are getting error, as we can see in the console of Xcode

Image 3rd show the correct way of uploading image/file into the project

The final image 4th show the output without any error/warning

Solution 4 - Ios

Just select the image in Xcode and in right side, File inspector, under 'Target Membership' make sure your project is selected. Another thing you can do is delete and re insert your image and make sure 'Copy items if needed' is selected and 'Add to targets' your project is selected.

Solution 5 - Ios

  1. Click on the image file in your Xcode navigator.
  2. Once selected, go to the right side bar (of XCODE) which is utilities and under file inspector, scroll to target membership and select your project target file.
  3. Then build and run the project again.

Solution 6 - Ios

Xcode9 beta2 release note:

> Jpeg assets in asset catalogs are not found on iOS 10 or earlier for apps built with Xcode 9. APIcalls for accessing the image such as UIImage.imageNamed: return nil. (32524123) > > Workaround: Use png resources or limit app testing to devices running iOS 11 or later.

Xcode9 beta3 release note:

>Jpeg assets in asset catalogs are found on iOS 10 or earlier for apps built with Xcode 9.(32524123)

Solution 7 - Ios

For those that are getting this error while developing a cocoapod

I was trying to use an image from my pod's bundle, thats inside a .xcassets file, in the storyboard. It would show fine in the storyboard but when i ran the app it would crash saying it cant find the resource.

I changed my podspec to include s.resources as well as s.resource_bundles

s.resource_bundles = {
  'SDKRes' => ['SDK/Assets/*']
}

s.resources = ['SDK/Assets/*.{xcassets}']

Then it was able to load the resource properly from the storyboard

Solution 8 - Ios

You can try opening your storyboard or nib as Source Code and 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.

Solution 9 - Ios

I have just updated to XCode 9 and it started giving me this issue. I created a new Image Set in the Assets section and added the images I wanted to this, then re-added them to my tab bar images with custom names and it worked fine. Hope this helps!

Solution 10 - Ios

PROBLEM
This happened to me seemingly out of the blue on a tab bar controller with icons for each tab. The storyboard was still showing my image icons and the assets existed with the expected names.

MY FIX
Select the tab bar icons in their respective view controller and reassign the image like you did the first time.

Solution 11 - Ios

This happened to me as well. I was doing everything right when adding the image but for some reason it was not working. I had to click on the image again once added, and then on the right toolbar under "Target Membership" I noticed my project was not selected even though I was selecting it when adding the image. I selected it here and everything worked fine.

Solution 12 - Ios

I got the same error message (in XCode 8), even though the app ran fine (in the simulator and on the device).

I found the problem: In my storyboard, using the document outline pane, I clicked through every single UIImage, and looking at the attributes inspector for each UIImage - in the Image View section - found that one UIImage had a blank file name (instead of the .png file name containing the image). Reselecting the .png file name from the dropdown box fixed the error message.

Solution 13 - Ios

I have fetching same issue in xcode 9.

just tick on target membership

enter image description here

Solution 14 - Ios

I pulled my hair out over this issue for hours and none of the solutions in this thread worked. The problem, in the end, was that the Xcode project files were stored on a Google Drive file stream. As soon as I moved it to the local drive or iCloud it worked fine.

Solution 15 - Ios

My case was a bit different. I was using an old IBDesignable element which had some property of setting an image directly from the storyboard. Since that element was old, hidden and unused the images it had were not present in my assets folder.

Now Xcode won't be able to search this image since it is not in the project anymore. But if you search in the finder, inside your project, you'll find the XIB/Storyboard in which it is mentioned. From there you can find it manually by opening that XIB or Storyboard as source code and search. Once found either replace them with a new image or remove the unused element.

Solution 16 - Ios

Look into storyboard file you'll see a question mark icon on any of the imageView (as shown in screenshot below) or UIButton image.
Just correct it and the warning will be gone.

invalid image in imageView

Hope this helps

Solution 17 - Ios

My guess is that you have an image in the Project Setting->Build Phases->Copy Bundle Resources which loses its reference and appears in Red text color. Remove this image from there and re-add.

This happens often due to relocate the image file after adding into project where image was added as a reference instead of a copy.

May be this can fix your issue.

Solution 18 - Ios

Urughhh. I tried to fix this with all the above solutions, but nothing worked. What finally worked was:

  1. Delete image from your project and select Move to Trash
  2. Clean project
  3. Close and restart XCode
  4. Rename your image filename so something other than the previous name
  5. Add new image to your project

Solution 19 - Ios

I was facing the same problem, I solve it by deleting folder and create again and past all images then add reference again.

Solution 20 - Ios

Based on what @hstdt posted above, it made me think I should check that my image is a filetype that doesn't have any bugs related to it. (https://stackoverflow.com/a/44558948/6804257)

I was using a .gif. I got rid of that image and instead used a .png. Now it works.

Solution 21 - Ios

Had the same issue and none of these answers worked for me. Instead I restarted the mac and iPhone I was working with and then everything started to work fine again. 路‍♂️

Solution 22 - Ios

My case is difference. I have more one assets folder. So I added to the wrong one. Just remove and add to the right.

Solution 23 - Ios

In my case,removing and adding the assets folder from the target fixed the issue.

Solution 24 - Ios

Xib sets a wrong name for folder reference images. For example I have the folder like Menu->icon.png. Xib sets the "icon" name for the image. It should be "Menu/icon". So do no set images in xibs if you use a folder reference images.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHilajView Question on Stackoverflow
Solution 1 - IosChase RobertsView Answer on Stackoverflow
Solution 2 - IosTal ZionView Answer on Stackoverflow
Solution 3 - IosKumarView Answer on Stackoverflow
Solution 4 - IosBhanupriyaView Answer on Stackoverflow
Solution 5 - IosnaughtynajView Answer on Stackoverflow
Solution 6 - IoshstdtView Answer on Stackoverflow
Solution 7 - IosFonixView Answer on Stackoverflow
Solution 8 - IosagyView Answer on Stackoverflow
Solution 9 - IosM. HoughtonView Answer on Stackoverflow
Solution 10 - IosrafView Answer on Stackoverflow
Solution 11 - IosSalokinSwiftView Answer on Stackoverflow
Solution 12 - IosUgoView Answer on Stackoverflow
Solution 13 - IosMitesh jadavView Answer on Stackoverflow
Solution 14 - IosTheGodricView Answer on Stackoverflow
Solution 15 - Iosnr5View Answer on Stackoverflow
Solution 16 - IosHaseeb JavedView Answer on Stackoverflow
Solution 17 - IosNeverHopelessView Answer on Stackoverflow
Solution 18 - IosB-MoneyView Answer on Stackoverflow
Solution 19 - IosShoaibView Answer on Stackoverflow
Solution 20 - IosJacob F. Davis C-CISOView Answer on Stackoverflow
Solution 21 - IosjguillenView Answer on Stackoverflow
Solution 22 - IosCường NguyễnView Answer on Stackoverflow
Solution 23 - IosNSpareshView Answer on Stackoverflow
Solution 24 - IosVoloda2View Answer on Stackoverflow