. Advertisement .
..3..
. Advertisement .
..4..
I get the “this class is not key value coding compliant for the key” issue when trying to link a UILabel with an IBOutlet. Here is the detail of the error I got the error message:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x6e36ae0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key XXX.'
Please give me some advice to solve this problem.
This is the error that you are making Possible causes of this error: You either removed, or renamed the outlet name in your Solution: Right-click on NSUnknownKeyException', reason: '[<UIViewController 0x3927310> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key string.
.h
file. It can be removed in the .xib
and .storyboard
files’ Connection Inspector.
<userDefinedRuntimeAttributes>
remained unchanged in xml (of foo.storyboard
).foo.storyboard
> Open As Source Code > Search by KeyPath (i.e. ShadowRadius > Delete the </userDefinedRuntimeAttributes>
causing the problem
Your xib may be experiencing a poor connection.
This error has happened to me many times. TechZen’s solution is correct in this instance. However, there is another common cause: changing the name of an IBOutlet property within your.h/.m that you have already connected to File’s owner in the nib.
From your home:
Check under ‘Referencing Outlets’ to make sure your object isn’t still linked to an old property name. Click the small x’ to delete this reference and rebuild again.
If you use Storyboard, another common problem is that your UIButton may have multiple assignings. (Solution works almost exactly the same way as nib).
This button has more than one assign/ref. You can remove one of the “Main …” greyed Windows with the small “x”.