Could not load “my-icon.png” image referenced from a nib (iPhone)

前端 未结 7 766
抹茶落季
抹茶落季 2021-01-06 06:44

I am receiving the following error message:

2011-02-11 14:47:13.815 myProject[13177:207] Could not load the \"icon-troubleshoot.png\" image referenced from a         


        
相关标签:
7条回答
  • 2021-01-06 07:13

    There must be a reference to this file in one of the nibs. If you can't find it, try deleting the nib file where the image was used, and create a new one.

    Also, check your bundle for a reference to the image file.

    0 讨论(0)
  • 2021-01-06 07:22

    I had this exact same issue and I found that when I included this file in the project I didn't specify both my Development and Distribution targets, only Development, so as soon as I tried building Distribution target, it wasn't found. You have to delete reference to this image, then re-add it and make sure you checkmark all of the targets that it should be found in.

    0 讨论(0)
  • 2021-01-06 07:26

    as far as I know the search tool of x-code do not search inside the xib files that's why your search returns nothing. Anyway It's really probable there's still a reference in a xib file somewhere. Because xib files are just xml, if you don't want to check all them manually, try to open all your xib with a text editor like TextMate and perform a global text search over the content for the .png filename.

    Hope this helps. Ciao!

    0 讨论(0)
  • 2021-01-06 07:26

    The warning message suggests there is a reference to this png file in your .xib or .nib file(s).

    Now the question is how to find it. Xcode is poor at doing this. Opening every nib file in a text editor like textedit and manual searching is time consuming.

    The best solution I have for such searching tasks is to fire up terminal and use grep command. Go to source folder of your project in terminal then you can run the following in your case:

        grep -i -r --include=*.xib "my-icon.png" ./
    

    This will return all *.xib files where my-icon.png is referenced. Later when you will see those *.xib files in xcode you'll find a '?' sign in place of my-icon.png showing that image is indeed missing as you deleted it. Now you deleted it to replace it with another image. So select '?' mark symbol, open Utilities area (to the right) and choose the correct file name. That is all.

    0 讨论(0)
  • 2021-01-06 07:32

    Clean the whole project and recompile.

    0 讨论(0)
  • 2021-01-06 07:32

    Select your storyboard object in solution explorer, right click on storyboard->"Open As"->"Source Code", now you will see xml code from storyboard. Search your image name with Cmd+F and replace or remove it.

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