Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

iphone

nib

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 nib in the bundle with identifier "com.myCompany.myProject"

This file is an old file that was being used before, but has now been deleted. As far as I know icon-troubleshoot.png is not used anywhere in my project. I tried cleaning and rebuilding, emptying caches but it didn't work. Searching for the string troubleshoot as a textual reference and "contains" selected returned nothing. Does anyone know how I can find what is causing this error?

like image 423
Casebash Avatar asked Nov 28 '22 22:11

Casebash


2 Answers

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.

like image 96
Mr.Hunt Avatar answered Dec 22 '22 08:12

Mr.Hunt


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!

like image 35
lomanf Avatar answered Dec 22 '22 09:12

lomanf