Joey
Joey

Reputation: 2978

how to know which xib file uses the image?

While running my project, I've got this error message.

Could not load the "bs_back_light.png" image referenced from a nib in the bundle with identifier "com.xxxxxxx.new"

I don't use the image file anymore, so I want to delete the image referencing in xib file. However, the project has a lot of xib files, and it is really hard to find xib file which references the image. If it is source file, I would use Find in Workspace(Shift + Command + F), but it doesn't search xib files.

How to search the image referencing from xib(nib) files?

I'm using Xcode Version 4.3.3 (4E3002)

Upvotes: 13

Views: 2938

Answers (4)

Alaeddin AL Zeybek
Alaeddin AL Zeybek

Reputation: 739

You can use xCode Find in Workspace(Shift + Command + F) now from version 6.x and above, it is now searches xib and storyboard files. See the Interface Builder section in the Xcode 6.0 Release Notes.

Thanks to Anna comment in a similar question

Upvotes: 1

Jacob
Jacob

Reputation: 926

I wrote a bash function based on Marco's answer so I wouldn't have to refer back to this post all the time. Just throw it in your bash profile, and you'll be able to run it from the command line in your project directory like "grep_xib UIButton", which would search all your *.xib files for instances of "UIButton". Just thought I'd share in case anyone else needed this.

function grep_xib {
    grep -i -r --include=*.xib "$1" .
}

Upvotes: 3

Marco Pace
Marco Pace

Reputation: 3870

I had the same problem and I resolved with some console commands. Open Terminal on your Mac and run this command:

grep -i -r --include=*.xib "bs_back_light.png" /your/project/path

It will search in the path "/your/project/path" and will print the complete path of all files xib that use the image "bs_back_light.png".

Hope this will help you!

Upvotes: 22

Yurec Antidipresant
Yurec Antidipresant

Reputation: 107

Look for it in your AppTarget: Build Phases - Compile Sources. If you have found - delete it :)

Upvotes: 0

Related Questions