我试图将UILabel与在类中创建的IBOutlet链接起来。
我的应用程序崩溃与以下错误。
这是什么意思?
我该怎么解决呢?
***终止应用由于未捕获异常'NSUnknownKeyException',原因:'[<UIViewController 0x6e36ae0> setValue:forUndefinedKey:]:这个类不是键值编码兼容的键XXX。'
我试图将UILabel与在类中创建的IBOutlet链接起来。
我的应用程序崩溃与以下错误。
这是什么意思?
我该怎么解决呢?
***终止应用由于未捕获异常'NSUnknownKeyException',原因:'[<UIViewController 0x6e36ae0> setValue:forUndefinedKey:]:这个类不是键值编码兼容的键XXX。'
当前回答
我只是在我的重复项目中有这个问题,并通过检查2个地方来解决:
1-确保你有。m文件在列表->项目-构建阶段-编译源代码 2-在那之后,去接口构建器(可能这是一个错误只发生在IB),并断开所有属性,标签,图像等…然后重新链接所有。我已经意识到我已经删除了一个属性,但它仍然在IB中链接。
希望这对一些人有用。
其他回答
我也遇到过同样的问题,虽然TechZen的答案可能确实令人惊讶,但我发现它很难适用于我的情况。
最终,我解决了这个问题,通过对象下列出的控制器(下图中突出显示)链接标签,而不是通过文件所有者。
希望这能有所帮助。
在升级到xcode7后,我遇到了swift类的这个问题。使用@objc指令解决了这个问题:
@objc(XXXView控制器)类XXXView控制器
这个错误是另一回事!
这是我如何解决它。我使用xcode版本6.1.1和使用swift。每次我的应用程序尝试执行segue跳转到下一个屏幕时,我都得到这个错误。这是我所做的。
Checked that the button was connected to the right action.(This wasn't the problem, but still good to check) Check that the button does not have any additional actions or outlets that you may have created by mistake. (This wasn't the problem, but still good to check) Check the logs and make sure that all the buttons in the NEXT SCREEN have the correct actions, and if there are any segues, make sure that they have a unique identifier. (This was the problem) One of the segues did not have a unique identifier One of the buttons had an action and two outlets that I created by mistake. Delete any additional outlets and make sure that you the segues to the next screen have unique identifiers.
欢呼,
我的方法和杰拉德·格伦迪类似。在使用XIB创建自定义UITableViewCell时,我错误地将自定义类名称应用到文件的所有者而不是UITableViewCell。将类应用到画布上的UITableViewCell并将IBOutlet属性连接到它上解决了这个问题。
我也有这个问题。我将带有IBOutlet的视图从一个xib文件复制到另一个xib文件。即使我已经删除了旧的引用并创建了一个新的引用,这个错误仍然发生。
我最终重新启动xcode来解决这个问题。