应用程序因未捕获的异常 NSUnknownKey 异常而终止,键值不符合编码 [英] App terminating due to uncaught exception NSUnknownKey Exception , key value not coding compliant

查看:20
本文介绍了应用程序因未捕获的异常 NSUnknownKey 异常而终止,键值不符合编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉问了这么简单的问题,但我是初学者

Sorry for asking such an easy question, but im a beginner

我正在学习有关构建应用程序的教程.我正在创建一个按钮,但我不小心把它命名错了,我命名它而不是在创建插座时.虽然我在创建动作时命名它是正确的.我运行了我的应用程序但它失败了,因为我的实例调用了,而不是(至少我认为这就是我的应用程序崩溃的原因.所以删除了插座和 xcode 为插座编写的自动代码,我重新制作了插座并将其命名为正确时间.但是现在当我运行我的应用程序时它终止了,报告如下:

I was following a tutorial on building apps. I was creating a button, but i accidently named it wrong, i named it instead of when creating the outlet. I named it right though when i created the action. I ran my app and it failed, because my instances called on , not (at least i think thats why my app crashed. So deleted the outlet and and the automatic code xcode writes for the outlet, i remade the outlet and named it right this time. But now when i run my app it terminates, heres the report:

2012-08-21 20:42:07.602 FieldButtonFun[973:c07] * 由于未捕获的异常NSUnknownKeyException"而终止应用程序,原因:[setValue:forUndefinedKey:]:此类不是键值编码- 符合 theNutton 键.* 首先抛出调用栈:(0x14b2022 0xeb2cd6 0x14b1ee1 0x9c3022 0x934f6b 0x934edb 0x94fd50 0x23771a 0x14b3dea 0x141d7f1 0x23626e 0xdc1fc 0xdc779 0xdc99b 0x3b401 0x3b670 0x3b836 0x4272a 0x13596 0x14274 0x23183 0x23c38 0x17634 0x139cef5 0x1486195 0x13eaff2 0x13e98da 0x13e8d84 0x13e8c9b 0x13c65 0x15626 0x271d 0x2685)终止称为抛出异常

2012-08-21 20:42:07.602 FieldButtonFun[973:c07] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key theNutton.' * First throw call stack: (0x14b2022 0xeb2cd6 0x14b1ee1 0x9c3022 0x934f6b 0x934edb 0x94fd50 0x23771a 0x14b3dea 0x141d7f1 0x23626e 0xdc1fc 0xdc779 0xdc99b 0x3b401 0x3b670 0x3b836 0x4272a 0x13596 0x14274 0x23183 0x23c38 0x17634 0x139cef5 0x1486195 0x13eaff2 0x13e98da 0x13e8d84 0x13e8c9b 0x13c65 0x15626 0x271d 0x2685) terminate called throwing an exception

我不知道出了什么问题,我根本不理解错误报告.我以为我已经删除了创建插座并重新制作它时生成的所有自动代码 Xcode.谁能帮我找出可能出了什么问题?

I have no idea what went wrong and i dont understand the error report at all. I thought i already deleted all the automatic code Xcode generated when i created the outlet and remade it. Could anyone help me and find out what could have went wrong?

我可以从头开始重建这个应用程序,但我想了解为什么会出错,以供将来参考.

I could rebuild this app from scratch but i want to understand why this went wrong, for future reference.

推荐答案

Xcode 在 FieldButtonFun 类中找不到键 theNutton 的值.

Xcode cannot find the value for the key theNutton in the class FieldButtonFun.

如果不看实际代码,很难说哪里出了问题.但在大多数情况下,XIB 文件中可能存在错误连接.请检查XIB,ctrl-click File's Owner,看看有没有黄色警告.

It's hard to say what's wrong without see the actual code. But in most cases, there could be a bad connection in the XIB file. Please check the XIB, ctrl-click the File's Owner, see if there is any yellow warning.

这篇关于应用程序因未捕获的异常 NSUnknownKey 异常而终止,键值不符合编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆