在運行時,我的應用程序拋出這個錯誤:爲什麼我得到一個關鍵值編碼合規性錯誤?
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x84231f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key count1.
有問題的COUNT1是一個標籤屬性。
@property (strong, nonatomic) IBOutlet UILabel *count1;
我鏈接到它在的.xib文件,我已經註釋掉每一個使用該屬性除了聲明,但錯誤依然存在。如果我完全刪除屬性,我會得到相同的異常問題,但現在的關鍵是「查看」而不是count1。
爲什麼會發生這種情況,我該如何解決?
我不理解你的問題,你的xib文件中有一個標籤引用一個名爲'count1'的屬性,並且你在你的代碼中將這個屬性重命名爲'view',現在你會得到這個錯誤,我是賴特嗎? ? – tkanzakic
您可能必須將''文件所有者'的'view'鏈接到xib。 – esh
閱讀此問題http://stackoverflow.com/questions/9612426/error-terminating-app-due-to-uncaught-exception-nsunknownkeyexception-reason – iPatel