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条回答
\"骚年 ilove
2楼-- · 2019-03-18 00:38

There is also another potential cause of this problem: If you upgraded to XCode 5 and use both the image asset catalog and "normal" images copied to your project (like you did prior XCode 5). If you then have images with identical names (e.g. "dog.png" and a image set called "dog") it might work in your storyboard and in the simulator, but you'll get this message when run on a real device (where the image will not be shown).

查看更多
SAY GOODBYE
3楼-- · 2019-03-18 00:38

Try moving the images directly to the Resources directory (not in a sub folder)

查看更多
劫难
4楼-- · 2019-03-18 00:38

Make sure the resource isn't too big to be handle.

查看更多
我命由我不由天
5楼-- · 2019-03-18 00:41

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

查看更多
三岁会撩人
6楼-- · 2019-03-18 00:44

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

alt text

查看更多
等我变得足够好
7楼-- · 2019-03-18 00:45

For some reason I was getting error until I put the image in the Assets.xcassets

查看更多
登录 后发表回答