Puzzling problem



I got most of the way through chapter 7 with my HypnoTime app working fine. I then made some changes as per the book’s instructions towards the end of the chapter and suddenly it crashed whenever I clicked into the Time view.

I couldn’t see my mistake in the code so I carefully picked my way back, undoing what I’d done until I got to the point where it worked again. I never got to that point - no matter how far I took it back it still did not work.

So I deleted the project and started from scratch, closely following the book’s instructions. It still had the same problem right from page 132 when I should be able to click between tabs. As soon as I click the second tab, the app crashes.

I tried the finished version of the app which was available to download from the Big Nerd Ranch site. That worked perfectly. I must have made a mistake so I deleted my HypnoTime project and started yet again. However, as son as I try to click that second tab, it crashes at the following line in main.m:

int retVal = UIApplicationMain(argc, argv, nil, nil);

with the following error:

Program received signal SIGABRT

The output console displays the following error:

*** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘-[UIViewController _loadViewFromNibNamed:bundle:] loaded the “CurrentTimeViewController” nib but the view outlet was not set.’

I can’t see anywhere in the book where I have been told to set an outlet for CurrentTimeViewController.

What am I doing wrong? I’d be very grateful for some advice as this is driving me mad.



I’m still picking through this problem, having gone over it all again and again but still had the same error.

I’ve now recreated the project for perhaps the 10th time but this time I have given the project a new name other than “HypnoTime”. Suddenly it works.

The code is identical - in fact I even copied it from my not-working HypnoTime project. There were no incorrect connections or delegates set in my HypnoTime project since I had repeatedly deleted that and started again from scratch doing exactly the same thing, each time with the same result.

How can this be? This has got me so confused and concerned that I can reach a seemingly arbitrary dead end.

Thanks in advance for any suggestions.


It would seem the issues is not in the Objective C code, but in the plist or XIB file. Could it be as simple as doing a clean/build to remove any residual problems? The fact that changing the project name changes the behavior points to something bad sticking around, even when you rebuild.

Otherwise, trusting that you followed the instructions perfectly, in a project that crashes, have you gone back to the CurrentTimeViewController.XIB and verified the connections? File’s Owner is set to CurrentTimeViewController? View object’s referencing outlet set to File’s Owner? File’s Owner’s View outlet set to the View object?


Thanks for your helpful reply. Perhaps I had introduced a problem with the connections in the XIB file, but it’s odd that deleting the whole project and starting right from scratch again didn’t get rid of that problem.

I’m certain I wasn’t just making the same mistake over and over again as I was following the instructions VERY closely, and then it suddenly worked when I started from scratch again but with a new project name.

If it happens again I’ll triple check the connections in the XIB before I do anything else and see what I can find.



The exception tells you exactly what is going on: *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘-[UIViewController _loadViewFromNibNamed:bundle:] loaded the “CurrentTimeViewController” nib but the view outlet was not set.’

This is saying that the CurrentTimeViewController XIB was loaded, but when asked for it’s view, the CurrentTimeViewController didn’t know anything about it. To fix this problem, you need to go into your CurrentTimeViewController.xib, right click on File’s Owner, and connect the view outlet to the root level view. See the top paragraph on p.139 in the 2nd edition of the book.