Terminating app due to uncaught exception NSUnknownKeyException
, reason:
[<UIViewController 0x8ac64e0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key first
.
What is the reason for this?
Terminating app due to uncaught exception NSUnknownKeyException
, reason:
[<UIViewController 0x8ac64e0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key first
.
What is the reason for this?
This could mean any number of things, but I tend to encounter this most often when an IBOutlet
isn't wired properly to an Interface Builder object in Xcode
. This can happen, for example, when the name of a property is changed in a header file, but the associated link to an object in Interface Builder isn't updated accordingly. This can also occur when you delete an object from a view in Interface Builder, but fail to delete or clear the property that was previously wired to it from a header file (.h)
.
Look at the relevant file (XIB
or Storyboard
) in Interface Builder. Right click on the object that contains your outlets (usually your owner, but it could be something else).
Verify that all outlets are properly wired to their corresponding properties in your header file. Any outlets that have problems will indicate an alert status indicator which will quickly lead you to the source of your trouble.