Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load nib in bundle on iPhone device

Tags:

iphone

ios4

I'm trying to test an app I'm developing on my iPhone. To do that I changed the target from Simulator to Device on Xcode. The application is correctly uploaded to the device and it works. The main view is shown but if I try to open a secondary view, the application crashes.

On the iPhone log (I installed the iPhone configuration utility to see the console [is the only way to see the log from iPhone?]) I can see this error:

Could not load NIB in bundle

But, on the simulator it works fine. What's wrong? Any ideas?

like image 256
Andrea Girardi Avatar asked Nov 11 '10 14:11

Andrea Girardi


3 Answers

I had the same problem and fixed it like so:

  1. Open XCode Target
  2. Click the "Build phases" tab
  3. Click the "Copy bundle resources" section
  4. Click the +
  5. Add the missing Nib file
like image 181
Iftach Orr Avatar answered Jan 05 '23 20:01

Iftach Orr


I've found that sometimes the device is case sensitive and the simulator is not.

What's the filename of your xib?


or

Try uninstalling the app from the simulator and installing it again - the simulator might have an old file left over from a previous run of the app - have you renamed / moved the xib at all during development?

like image 41
deanWombourne Avatar answered Jan 05 '23 21:01

deanWombourne


I had a similar problem and was getting the same error. Turns out I was using the full name of the xib file in the attributes panel under "NIB Name:"

Don't use "SomeViewController.xib", just use "SomeViewController" without the ".xib" extension.

like image 26
markquezada Avatar answered Jan 05 '23 20:01

markquezada