NSInternalInconsistencyException – reason: ‘Could not load NIB in bundle’


Is it ambiguous ? Well at the outset it seems to be.

After a swag of updates (iOS 6, Xcode, OSX 10.8.2 ::modem has officially asked for time off now::) I opened an existing client project that was working previously. This project was used during a prototyping session with the client, so why does it break now ?

The error:
2012-09-21 07:42:07.257 Stenhouse Workshop[3017:c07] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Could not load NIB in bundle: ‘NSBundle /Users/paulusher 1/Library/Application Support/iPhone Simulator/6.0/Applications/B1F4C9E9-EAB6-4AD8-96D6-D82EDD9E6E48/Stenhouse Workshop.app (loaded)’ with name ‘WorksheetViewController”
*** First throw call stack:
(0x1c99012 0x10d6e7e 0x1c98deb 0x239fac 0xfee37 0xff418 0xff648 0xff882 0x10b235 0x30a3d2 0x1084f3 0x108777 0x96d933f 0x1087b7 0x25ee 0x10ea705 0x21920 0x218b8 0xe2671 0xe2bcf 0xe1d38 0x5133f 0x51552 0x2f3aa 0x20cf8 0x1bf4df9 0x1bf4ad0 0x1c0ebf5 0x1c0e962 0x1c3fbb6 0x1c3ef44 0x1c3ee1b 0x1bf37e3 0x1bf3668 0x1e65c 0x1e7d 0x1da5)
libc++abi.dylib: terminate called throwing an exception

Googling this type of thing will send you on a wild goose chase, the NSInternalConsistancyException seems to cover a lot of ground.

Because of the number of upgrades that had taken place I decided to start by doing a ‘clean’ on the project,when that failed, reseting the content on the iOS Simulator, still nothing, (insert head banging here). I checked all the connections, made sure no objects had been removed leaving bad things behind. There were some ‘warnings’ on the project, pointing at deprecated color options on my grids. So dutifully, I changed the selection to something that was current, did another clean and build but the app still crashed.

I then noticed the smallest difference, the NIB name was “WorksheetViewController” and the code was calling “WorkSheetViewController”. It seems the issue of the Simulator correcting these behind the scenes has been fixed (see the note here on Simulator black magic)

After a quick alteration of the NIB name the project was useable again. So while technically it was not anything specific to the OS changes that broke the project, it was changes in Xcode and the Simulator. Of course the app would have crashed on the device anyway, so at least we were spared that pain.

What would have been nice to see was an error message something like- reason: ‘Could not load NIB in bundle: NIB File Not Found’.