App crash 报错 'NSUnknownKeyException'

报错:

*** Terminating app due to uncaught exception , reason: '[<NSObject 0x6e36ae0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key XXX.'

原因:

xib控件与swift变量绑定有问题。每个变量在File's Owner和view中都绑定了,绑定了两次。

解决方法:

在xib的File's Owner中去掉控件和变量的绑定。

原文地址:https://www.cnblogs.com/argenbarbie/p/5817416.html