Categories
Swift

Could not load the image referenced from a nib in the bundle running on device

In use xcode Make a program when,We generally use some pictures instead of stiff off button text,Make the interface more beautiful。

but,When adding pictures,I met when editing storyboard You can display,But the problem when the program is running, but can not be displayed。

View Record found error:

Nations on swift Development of documentation and Q is too small,Even the tutorial is ambiguous - in fact, you can not blame people,after all xcode Update soon,Many tutorial time or beta version,But now it is already the official version。(For example, in this tutorial I see people inside obviously has no such problem。)

but,At all events,There are still many foreign friends and I encountered the same problem,Final,Let me get a solution:

  1. Click the name of your project,The right of the code area will become a common option;
  2. Among the options on the right to find "Build Phases"Tab;
  3. In the inside "Copy Bundle Resources"This is one of them,Click the "+" sign to add a picture;
  4. of course,Drop here also possible。

but,I encountered in the process of doing soanother question

If you just drag or click the "+" Import Folders,The problem is still。At this time you need to put a picture of each individual import (that is, do not use the folder),Then look at the picture should be able to compile and run properly displayed,At this moment,Then go back and delete these pictures just introduced alone。

Maybe,This is a bug。

——————————

In short,When you import the check copy to the project not always wrong。😃

 

Further reading:

Could not load the image referenced from a nib in the bundle running on device

Original article written by Gerber drop-off:R0uter's Blog » Could not load the image referenced from a nib in the bundle running on device

Reproduced Please keep the source and description link:https://www.logcg.com/archives/999.html

By R0uter's Blog

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Leave a Reply

Your email address will not be published. Required fields are marked *