NSInternalInconsistencyException, reason: Could not load NIB in bundle

There can be quite a number of reasons that could raise the error you're receiving.

I'll start enumerating some things to check for and solutions:

Have you renamed your xib or storyboard file outside Xcode? If so, check everywhere you have a reference to it for inconsistencies. Also be sure you respect the uppercase / lowercase letters anywhere you reference the file since is case sensitive.

Go to Interface Builder, select your View1 ViewController > Utilities Panel > Identity Inspector > check if the Custom Class corresponds to your ViewController Class if you have one (.h and .m files).

Check your Info.plist file. If you use storyboads, you should have an entry like Main storyboard file base name and NOT Main nib file base name. If you use nibs, then is vice-versa. Also check that the file base name corresponds with name of the actual file.

Check your target's Build Phases > Copy Bundle Resources and make sure that your xib or storyboard file is added there.

If you instantiate your View1 ViewController programmatically and you use xib file check the nib name for typos (remember, is case-sensitive). Also, if you currently append .xib file format to the name, remove the extension because it shouldn't be used. What I mean is this line of code: UIViewController *controller = [[UIViewController alloc] initWithNibName:@"xibFileName" bundle:nil];

Check the properties of your xib or storyboard file in the file inspector and make sure that your file is linked to your target in the Target Membership selection panel.

Check the properties of the xib or storyboard file in the file inspector and try switching your file Location to Relative to project or Relative to group. See if either way makes a difference.

If you're adding your view controller programmatically in the initWithCoder then you should instantiate it in the viewDidLoad method instead

If nothing from above applies to your situation, you could delete the file from Xcode (select Remove References) and import it again in your project.

Remember to ALWAYS clean your project after making the above changes (SHIFT+COMMAND+K).

Please let us know if it worked and what worked.

https://stackoverflow.com/questions/27842740/nsinternalinconsistencyexception-reason-could-not-load-nib-in-bundle/28037785

你可能感兴趣的:(NSInternalInconsistencyException, reason: Could not load NIB in bundle)