问题描述
我有一个 NavigationController
、名为ViewController"的根视图控制器和名为SettingsViewController"的第二个视图控制器.我有一个从ViewController"到SettingsViewController"的segue,它一直有效,直到我尝试通过参考插座将一个名为usernameField"的UITextField
连接到SettingsViewController".当我尝试转到 SettingsViewController 时,出现以下错误:
I have a NavigationController
, root view controller called "ViewController" and a second view controller called "SettingsViewController". I have a segue to the "SettingsViewController" from "ViewController" which worked until I tried to connect a UITextField
called "usernameField" to the "SettingsViewController" by means of Reference Outlet. When I did I got the following error whenever I try to go to the SettingsViewController:
*** 由于未捕获的异常NSUnknownKeyException"而终止应用,原因:[<_TtC6mayfly22SettingsViewController 0x15e72af0> setValue:forUndefinedKey:]:此类不符合键值编码的键 usernameField.'
当我在谷歌上搜索错误时,大多数人说这是由在代码中删除但在故事板中未删除的参考插座或类似内容引起的,但是我已经彻底检查并尝试多次重新制作文本框.我可能做错了什么导致此错误?
When I googled the error, most people said that it was caused by a reference outlet that got deleted in code but not in storyboard, or something along those lines, however I have thoroughly checked and have tried remaking the text box numerous times. What could I be doing wrong that could be causing this error?
推荐答案
通过清理应用程序并重建它来解决这个问题.产品 > 清理或 Shift + Command + K
Solve this problem by cleaning app and rebuilding it. Product > Clean or Shift + Command + K
这篇关于类不符合键值编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!