Could not load the image referenced from a nib in

2019-03-18 00:37发布

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.

16条回答
贼婆χ
2楼-- · 2019-03-18 00:47

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

查看更多
聊天终结者
3楼-- · 2019-03-18 00:51

I had the same problem, but the cause was very different. I was using image sets in the Asset Catalog that varied based on the device idiom: iPad or iPhone.

The framework target they were being added to had been accidentally marked as as having a deployment device type of iPhone, so the images weren't showing up on iPads - they weren't even being copied into the .car file in the framework.

Setting the deployment device type to Universal, as it should have been, solved the problem.

查看更多
女痞
4楼-- · 2019-03-18 00:55

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!

查看更多
倾城 Initia
5楼-- · 2019-03-18 00:57

None of these things work for me. I created a new folder in the projects where I placed the pictures. That worked for me.

查看更多
Juvenile、少年°
6楼-- · 2019-03-18 00:58

None of the above worked for me, and the message I got was "could not load the "(null)" image referenced... which means I could not look for the image. Very frustrating. In the end it became a trial and error exercise of going through every xib and storyboard looking for potential conflicts. I finally found it - I had specified a "Selected Image" for a tab bar item which was not needed. As soon as I got rid of that the problem went away.

查看更多
Melony?
7楼-- · 2019-03-18 00:58

Make sure it is included in your Target Membership

  1. Select your "Images.xcassets" file in the file Inspector
  2. Open File Inspector (cmd + opt + 1)
  3. Select your target membership (Usually 1st line)
查看更多
登录 后发表回答