Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key itemName.'
使用的是NIB文件/界面生成器,此错误消息的真正含义是:在NIB文件中有一个ui元素通过IBOutlet连接到了controller中的某一个对象,但是该对向不存在。
我遇到的时候,我没有修改任何变量,仅仅时添加了一个函数,这样也发生了这个问题,我不知道具体时哪个变量的Outlet那有问题,所以我把之前的所有连接都删除了,重新连接就可以了。
If you're using NIB files / Interface Builder, what this error message REALLY means is:
"Your NIB file has a GUI element that's connected (via the Outlets screen) to an outlet in one of your source files that doesn't exist"
i.e. it usually happens when you change the name of an IBOutlet variable in your source file, and forget to change your NIB file to reflect the change.
(sadly, Interface Builder isn't good enough to automatically rename the connection, as it is supposed to do - you MUST do it manually)
本文探讨了在Objective-C编程中使用NIB文件时,出现NSUnknownKeyException错误的原因及解决方案,着重解释了错误消息的真正含义以及如何避免此类问题的发生。
418

被折叠的 条评论
为什么被折叠?



