Quiz app crashing @ launch - Single View app vs Blank [EDIT]


Hi all,

I ran into an issue that stumped both me AND my brother (who is a good bit more experienced than I with creating iOS apps) while attempting to run the Quiz app.

I had no issues during build, but upon attempting to run the app within the iOS Simulator, the output console in Xcode would display the following:

*** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: '[<UIApplication 0x8c3dd10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key answerLabel.

We were totally stumped! :astonished: I spent between three and four hours today attempting to debug my code and generally changing things in my code, such as label names, quiz questions and answers, etc (that shouldn’t have made any difference with the app actually running) to have it match the solution code I downloaded down to the letter. Nothing I did during this process actually fixed my issue! :angry: :unamused:

Finally, I decided to search on StackOverflow for any sort of general solution to this error. I found my solution here: http://stackoverflow.com/questions/3088059/this-class-is-not-key-value-coding-compliant-for-the-key - specifically:

[quote]If it is an iPhone only app, not a universal one, make sure the following field is empty:

Targets > Summary > iPhone/iPod Deployment Info > Main Interface

If you specify an xib there it crashes.

answered Jun 30 '12 at 13:00
community wiki

Lo and behold: that was my issue. :unamused:

In Xcode: click on Quiz > General tab > scroll down to Deployment Info. Mine looked like this:

I corrected it as such:

Built it again, and this time it ran perfectly.

I just wanted to share this in the hopes helping another Xcode/iOS programming n00b like myself with any similar issues - and perhaps with saving a fellow coding newbie precious, valuable time in the process.


This is happening more than likely because you selected a Single View Application vs. a Blank Application like the book suggest.


After I posted the above, I actually started wondering if there was something I overlooked - what you suggest sounds very plausible. Well, at any rate, fix is there for anyone else who overlooks it like I did :laughing: