问题
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:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<_TtC6mayfly22SettingsViewController 0x15e72af0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key 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?
回答1:
Solve this problem by cleaning app and rebuilding it. Product > Clean or Shift + Command + K
来源:https://stackoverflow.com/questions/24580908/class-is-not-key-value-coding-compliant