October 2011 - Byron Salau

How to fix “this class is not key value coding-compliant for the key”

Posted by | objective-c | No Comments

If you ever come across this error:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key ...'

It is likely you have either renamed an IBOutlet property or removed a nib (.xib) file associated with your class.

If you removed the nib and decided to go nibless you can fix this error by simply selecting “Reset Content and Settings” from the ios simulator menu or “delete” the app from your device. You may also have to perform a “Clean” in xcode (Product > Clean).

Otherwise, If you still have your nib and renamed an IBOutlet property then simply open the nib file and reconnect your IBOutlet with its corresponding UI control. You may also need to disconnect the old one. It should appear grayed out.