Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I solve a 'NSUnknownKeyException' ... setValue:forUndefinedKey:]: ...not key value coding compliant [duplicate]

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] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key done.'

* 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)

@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

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.

like image 390
ipatch Avatar asked Jun 20 '12 11:06

ipatch


3 Answers

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.

like image 161
Phillip Mills Avatar answered Nov 18 '22 05:11

Phillip Mills


The easiest way to check that is to Ctrl+Click on your Controller in the Storyboard View and look for something in the resulting popup which has a yellow warning mark next to it. Simply delete it by pressing the (x) next to the Outlet name.

like image 35
kaskader Avatar answered Nov 18 '22 03:11

kaskader


If you are using a storyboard then just click on every ViewController and select the connections inspector of them. Check whether there exit any exclamatory sign(for lost connections).

Delete them properly.Then run your project again.

like image 4
Sauvik Dolui Avatar answered Nov 18 '22 03:11

Sauvik Dolui