首页 > 代码库 > App crash 报错 'NSUnknownKeyException'

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中去掉控件和变量的绑定。

App crash 报错 'NSUnknownKeyException'