iOS iPad simulator crashes, but not iPhone


I foolishly started trying to implement a DetailViewController~ipad.xib, and realized that it wasn’t really a part of the current chapter. After deleting the iPad xib file, the iPad simulator crashes every time I click on an item and it tries to load the DetailViewController view. The iPhone simulator runs perfectly. I even tried switching the project back to iPhone only, but it didn’t make a difference, the iPad simulator always crashes.

As far as I can tell, the view outlet is still wired properly (otherwise the iPhone would crash as well). I updated the code to match the book (Location 6861, 44%) to where it uses the new initializer in ItemsViewController.m:

This is the error message I’ve been getting:

[quote]2012-05-15 10:58:35.730 Homepwner[19779:f803] Alloc DetailViewController
2012-05-15 10:58:35.733 Homepwner[19779:f803] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘-[UIViewController _loadViewFromNibNamed:bundle:] loaded the “DetailViewController” nib but the view outlet was not set.’
*** First throw call stack:
(0x13d0022 0x1561cd6 0x1378a48 0x13789b9 0xe12dd 0xe1779 0xe199b 0xe1d11 0xf38fd 0xf3aef 0xf3dbb 0xf485f 0xf4e06 0xf4a24 0x24ec 0xab5c5 0xab7fa 0x94085d 0x13a4936 0x13a43d7 0x1307790 0x1306d84 0x1306c9b 0x12b97d8 0x12b988a 0x1a626 0x1bbd 0x1b25)
terminate called throwing an exception[/quote]


Looks like it was a caching issue with the actual saved application files located here:

/Users/(user name)/Library/Application Support/iPhone Simulator/5.1/Applications/89DCA346-ABF5-4A26-B7CB-1F61B53D631C/

I deleted the whole directory named “89DCA346-ABF5-4A26-B7CB-1F61B53D631C” and everything works now. Hooray for NSLog!


Xcode is notoriously bad about updating resource files in an already built application. If you delete a resource file, you should either clean the project or delete it from the Simulator (or effectively delete it from the simulator by trashing the directory you trashed).


I tried the Product > Clean menu command earlier, but it didn’t seem to have any effect… But now I know at least one way that fixes this. I just wish it was easier to figure out what was actually happening there/


Yeah, the only way to really check is pretty much what you’ve done. You can always confirm by navigating to that folder and seeing what is insidei t.


Oh Brother. I did exactly the same thing and got exactly the same results. I spent hours this afternoon looking through the code trying to figure out why it worked the first time. I was just about to convince myself that it really never worked the first time when I saw this.


I decided to go ahead with creating separate .xib files and ran into the same error mentioned above. Deleting the folder with those random numbers did not help much (and it didn’t look like a good solution). What did help though was this post from StackOverflow -

Copy-Pasting it here for good measure: (Credits:
Open the XIB file causing problems
Click on file’s owner icon on the left bar (top one, looks like a yellow outlined box)
If you don’t see the right-hand sidebar, click on the third icon above “view” in your toolbar. This will show the right-hand sidebar
In the right-hand sidebar, click on the third tab–the one that looks a bit like a newspaper
Under “Custom Class” at the top, make sure Class is the name of the ViewController that should correspond to this view. If not, enter it
In the right-hand sidebar, click on the last tab–the one that looks like a circle with an arrow in it
You should see “outlets” with “view” under it. Drag the circle next to it over to the “view” icon on the left bar (bottom one, looks like a white square with a thick gray outline
Save the xib and re-run


Thanks for everyone’s replies, I was stuck on this for a day. Deleting the app from the iPad and rebuilding it fixed the problem (clicking and holding the app icon, and pushing the x button).