學科:IOS/KB/Uncaught exception

來自維基學院

this class is not key value coding-compliant for the key[編輯 | 編輯原始碼]

示例:

 *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MyClass 0x1ddc5400> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key MyTitle.'

可能原因:

  • IBOutlet沒有正確設置,沒連,或者連的位置不對
  • MyClass的實現部分沒synthesize MyTitle變量