Could not load the “” image referenced from a nib

前端 未结 21 2351
广开言路
广开言路 2020-12-23 19:21

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 ha

相关标签:
21条回答
  • 2020-12-23 20:16

    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

    0 讨论(0)
  • 2020-12-23 20:16

    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.

    0 讨论(0)
  • 2020-12-23 20:17

    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.

    0 讨论(0)
  • 2020-12-23 20:17

    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.

    0 讨论(0)
  • 2020-12-23 20:17

    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.

    0 讨论(0)
  • 2020-12-23 20:19

    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.

    0 讨论(0)
提交回复
热议问题