如何解决“NSUnknownKeyException"... setValue:forUndefinedKey:]: ...不符合键值编码 [英] How do I solve a 'NSUnknownKeyException' ... setValue:forUndefinedKey:]: ...not key value coding compliant

查看:51
本文介绍了如何解决“NSUnknownKeyException"... setValue:forUndefinedKey:]: ...不符合键值编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我会尽量写得简短一些.我想在键盘上方添加一个 UIToolbar,我花了一段时间才弄明白,我最终做到了,但是当我尝试向按钮添加功能时 previous *next* 和 done 我的程序很快就无法编译了.

Alright, I'll try and make this brief as possible. I wanted to a UIToolbar above my keyboard, and it took me a while to figure it out, and I eventually did, but when I tried adding function to the buttons previous *next* and done my program would soon not compile.

可以在这里看到整个错误消息:

The entire error message can be seen here:

2012-06-20 05:36:55.276 KegCop[79460:fb03] * 由于未捕获的异常NSUnknownKeyException"而终止应用程序,原因:[setValue:forUndefinedKey:]:这个类是不符合已完成键的键值编码.'

2012-06-20 05:36:55.276 KegCop[79460:fb03] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key done.'

* 第一次抛出调用栈:(0x134a022 0x1733cd6 0x1349ee1 0xd31022 0xca2f6b 0xca2edb 0xcbdd50 0x5a571a 0x134bdea 0x12b57f1 0x5a426e 0x7adeef 0x7ae03e 0x382d7a 0x382ff8 0x38217f 0x391183 0x391c38 0x385634 0x1f84ef5 0x131e195 0x1282ff2 0x12818da 0x1280d84 0x1280c9b 0x381c65 0x383626 0x2a8d 0x29f5为0x1)终止调用抛出异常(lldb)

* First throw call stack: (0x134a022 0x1733cd6 0x1349ee1 0xd31022 0xca2f6b 0xca2edb 0xcbdd50 0x5a571a 0x134bdea 0x12b57f1 0x5a426e 0x7adeef 0x7ae03e 0x382d7a 0x382ff8 0x38217f 0x391183 0x391c38 0x385634 0x1f84ef5 0x131e195 0x1282ff2 0x12818da 0x1280d84 0x1280c9b 0x381c65 0x383626 0x2a8d 0x29f5 0x1) terminate called throwing an exception(lldb)

@Abitern 建议我应该阅读 关于键值编码指南的 Apple 文档.不管怎样,无论你怎么看,它都超级晚了,或者超级早了.更新后的项目可以在这里找到:https://github.com/ipatch/KegCop

@Abizern suggested I should read the Apple Doc on Key value coding guide. Anyways it's super late, or super early however you look at it. The updated project can be found here: https://github.com/ipatch/KegCop

只需下载 zip,然后尝试构建,您就会明白我在说什么.错误可能存在于 ViewControllerWelcome.m 文件中.

Just download the zip, and try and build and you will see what I am talking about. The error probably lies somewhere in the ViewControllerWelcome.m file.

推荐答案

在您的故事板或 xib(无论您使用哪个)中查找 ViewControllerWelcome 对象.此错误的最可能来源是某些与名为 done 的操作或出口的连接,而该连接在该类的代码中不存在.

Look in your storyboard or xib (whichever you're using) for the ViewControllerWelcome object. The most likely source of this error is that something has a connection to an action or outlet called done that doesn't exist in the code for that class.

这篇关于如何解决“NSUnknownKeyException"... setValue:forUndefinedKey:]: ...不符合键值编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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