I was running my program whenn it crashed and gave me a error of NSInternalInconsistencyException reason: Could not load NIB in bundle can anyone help please

Recommended Answers

All 2 Replies

Build it with the debug flags enabled and then run it in the debugger. It is either that, or sprinkling a bunch of print statements through your code to help isolate the problem. For core dump exceptions like this, I find that running in the debugger is the better choice. For non-fatal, but inappropriate behavior (wrong output for given input for example), then diagnostic print statements can be very useful.

You can get this error if you are trying to load a nib file that doesn't exist in the bundle.

Say you are doing something like this:

UIView* view = [[UIView alloc] initWithNibName:@"MyNibFile" bundle:mainBundle];

or this:

NSArray* objects = [[NSBundle mainBundle] loadNibNamed:@"MyNibFile" owner:nil options:nil];

The two reasons I usually get this is either 0) The nib file name is misspelled (the solution to this is obvious) or 1) The nib file isn't being compiled into the target I'm building. To fix this, select your nib file in your project navigator and open the file inspector and make sure that the Target Membership is correctly set.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.