Ashish Agarwal
Ashish Agarwal

Reputation: 14925

Why is my iPhone app crashing with the exception "Could not load NIB in bundle"?

I am learning how to make iPhone apps in the simulator but my app crashes as soon as it launches in the simulator. Also, there are no errors and no warnings when I compile the source code.

Here is a copy of the console logs -

2011-10-27 04:49:08.376 login[1192:207] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'LoginView'' * Call stack at first throw: (

0   CoreFoundation                      0x00dc85a9 __exceptionPreprocess + 185
1   libobjc.A.dylib                     0x00f1c313 objc_exception_throw + 44
2   CoreFoundation                      0x00d80ef8 +[NSException raise:format:arguments:] + 136
3   CoreFoundation                      0x00d80e6a +[NSException raise:format:] + 58
4   UIKit                               0x004b30fa -[UINib instantiateWithOwner:options:] + 2024
5   UIKit                               0x004b4ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
6   UIKit                               0x0036a628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
7   UIKit                               0x00368134 -[UIViewController loadView] + 120
8   UIKit                               0x0036800e -[UIViewController view] + 56
9   login                               0x000029c3 -[loginViewController viewDidLoad] + 165
10  UIKit                               0x004b2f26 -[UINib instantiateWithOwner:options:] + 1556
11  UIKit                               0x004b4ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
12  UIKit                               0x002ba17a -[UIApplication _loadMainNibFile] + 172
13  UIKit                               0x002bacf4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
14  UIKit                               0x002c5617 -[UIApplication handleEvent:withNewEvent:] + 1533
15  UIKit                               0x002bdabf -[UIApplication sendEvent:] + 71
16  UIKit                               0x002c2f2e _UIApplicationHandleEvent + 7576
17  GraphicsServices                    0x01720992 PurpleEventCallback + 1550
18  CoreFoundation                      0x00da9944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
19  CoreFoundation                      0x00d09cf7 __CFRunLoopDoSource1 + 215
20  CoreFoundation                      0x00d06f83 __CFRunLoopRun + 979
21  CoreFoundation                      0x00d06840 CFRunLoopRunSpecific + 208
22  CoreFoundation                      0x00d06761 CFRunLoopRunInMode + 97
23  UIKit                               0x002ba7d2 -[UIApplication _run] + 623
24  UIKit                               0x002c6c93 UIApplicationMain + 1160
25  login                               0x00002694 main + 102
26  login                               0x00002625 start + 53
)

terminate called after throwing an instance of 'NSException'

I have tried and tried and can't seem to fix this problem. I will appreciate any help.

Upvotes: 3

Views: 3678

Answers (1)

jbat100
jbat100

Reputation: 16827

Your app is trying to load a file called LoginView.xib, and failing to. Seems like this file is referenced from your MainWindow.xib (or whichever is your main nib file as defined in your application plist). Check that this file exists, is copied to the bundle (in the copy resources build phase). If that's the case you can try cleaning the project, restarting xCode and trying again (I had this problem occasionally, for no apparent reason when switching between iPhone/iPad targets).

Upvotes: 6

Related Questions