I’m having a problem similar to the one discussed in this thread, but the solution provided to him isn’t working for me. I apologize for the lengthy description, but this is my first post on SO and I want to be complete.
I have a program that runs fine in the simulator. However, when I try to push it out to the device, I get an error that says this:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/....app> (loaded)' with name 'MainWindow''
So: it’s trying to load a XIB called MainWindow, but it can’t find it. That’s because I don’t have a XIB called MainWindow; the first XIB I load is called FrontPage.xib. I didn’t start this program using one of the templates and thus was not provided with a MainWindow.xib file at the beginning.
The Google machine tells me that the Main nib file base name can be modified in my app’s plist. So, I go there and I change it to FrontPage. Now, I get a different error:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x12c270> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
I’m pulling my hair out over here – anyone know a solution?
If Frontpage.xib is going to be your application’s main xib, then you have to create a Window object and an App Delegate object in that xib in order for the app to be able to load. Before you can start presenting view controllers and such you have to configure the app and the window or it will crash as you describe. I would suggest creating a new project using a Window based template and just take a look at the MainWindow.xib that gets created automatically and try to mimic it in your Frontpage.xib..
.. Although I would just sincerely suggest using a MainWindow.sib in your project and making your Frontpage.xib a normal view controller xib. If you choose to add a new file to your project, then choose User Interface, then choose Application xib instead of View xib, then it will set you up with something close to what you need.
The project templates are important and useful. You should always use them. I start all of mine with a Window Based template. It is the most basic template and the most flexible.