0

At runtime my app is throwing this error:

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

The count1 in question is a label property.

@property (strong, nonatomic) IBOutlet UILabel *count1;

I link to it in the .xib file, I have commented out every single use of the property except for the declaration but the error persists. If I remove the property altogether I get the same exception problem but the key is now 'view' instead of count1.

Why is this happening and how can I fix it?

Ken Thomases
  • 88,520
  • 7
  • 116
  • 154
shadowmaster13
  • 63
  • 2
  • 10
  • I'm not understanding your question, you have a label in your xib file referencing a property called `count1` and do you rename this property to `view` in your code and now do you get this error, am I wright? – tkanzakic Apr 13 '13 at 09:01
  • 1
    You may have to link the `view` from the `file's owner` to the xib. – esh Apr 13 '13 at 09:08
  • read this question http://stackoverflow.com/questions/9612426/error-terminating-app-due-to-uncaught-exception-nsunknownkeyexception-reason – iPatel Apr 13 '13 at 09:15

1 Answers1

1

The property is being accessed on UIApplication. Wherever you declared count1, it was not on UIApplication. It might have been a custom subclass of UIApplication, but you can't have changed UIApplication itself.

So, either something is attempting to access the count1 property on the application object when you meant it to access it on some other object, or you meant to use a custom application object but you're not actually doing so. If you intend to use a custom subclass of UIApplication for your application object, be sure to pass that class's name to UIApplicationMain(). Otherwise, you have probably connected an outlet incorrectly.

Ken Thomases
  • 88,520
  • 7
  • 116
  • 154