3
votes

I'm having a strange error in my iOS app. Everything was working well since yesterday and today I made some improvements on a view controller that has nothing to do with the AppDelegate and when I tried to test the changes I've made on the simulator, I got this error :

* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'xxx'

I searched a lot in Google and this website to try to find a solution, and all the topics I found were talking about problems with xib files. However, I'm using Storyboards and my app is iOS6.1 only so I have no xib files ... I also checked that the storyboard was included in "Build Phases" and everything seems right :s. I know that this error could happen when some files were included in the Finder but not in Xcode, however that's not the case for me: I always included the files directly in Xcode and checked the "copy files to directory" option. I even tried to revert the changes I made, and I still have this issue so I really don't know what is going on. My app is really simple at this stage, I just have a couple of view controllers connected through a navigation controller and 1 external framework (AFNetworking). My AppDelegate (where the error seems to happen) is clean: I didn't add anything to the sample code that was provided by Xcode.

I'm really stuck with this issue and I hope you could find a way to help me solve it.

2
Did you localized your storyboard ? - danypata
No, I have the "en" localized storyboard that was automatically provided (I guess). But I didn't do anything to localize my app. - user2285781
One more thing, clickon your storyboard file -> Show the file inspector -> target membership, make sure there is a check mark on the project. - danypata
Does it really say "...name 'xxx'" in the error message? - mharper
No, I changed to put xxx but the real 'nam' is just a code that can't give any indication (and would increase the weight of the title ^^). Correct me if I'm wrong. - user2285781

2 Answers

1
votes

First, try using the Xcode/Product/Clean menu item. If that doesn't do it then go to the Organizer, switch to Projects, and delete the Derived folder for your project. If you do the second, quit Xcode and start again just to be sure all is wiped.

EDIT: if you want, zip the thing up, and send it to my email address in my profile. I can only spend a few minutes with it but will at least take a look.

EDIT2: learned a few things here, but no fix. What you are seeing is that the StoryBoard is trying to product the rootViewController, and fails - the app delegate never even gets messaged. The EventsTVC class gets sent initWithCoder:, and then later is asked for its nibName, which it returns. This nibName is an identifier into the storyboard - and is what internally Apple must be using to construct a nib. However, that fails. You can see the name by adding this to EventsTVC:

- (NSString *)nibName
{
    NSLog(@"NIB NAME %@", [super nibName]);
}

What I did to reproduce the problem was create a new StoryBoard Master/Detail app, and add this to the rootviewcontroller:

- (NSString *)nibName
{
    NSLog(@"NIB NAME %@", [super nibName]);
    return [[super nibName] stringByAppendingString:@"foo"];
}

This of course makes the nibName bogus, and it causes the app to fail where yours does, with the same message.

You have two choices: you can burn a DTS incident on this - see if you can get Apple to fix it (might take a few days), or you can just redo the project, and copy as much of what you can back into the new App.

In any case it would be really great if you could send the same zip file to Apple and create a bug report on it. I suspect that the storyboard is corrupt internally, but there are no public methods to use to delve into it (look at UIStoryBoard).

1
votes

Since ios7 and Xcode 5, it does this to me every morning ! I don't know what kind of mess they did in xcode but it's annoying. If you want to pass this bug, go to organizer, then delete the "derived data" (if somehow it doesn't want to delete, go delete it in terminal with a good old rm -rf), then run you app, it will crash again, this time go to you simulator and click on reset settings and everything. Now run your App again your done :) !