35

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.

jrturton
  • 118,105
  • 32
  • 252
  • 268
ipatch
  • 3,933
  • 8
  • 60
  • 99
  • Enable exception breakpoints. This will tell you where the problem code lies. You can't expect people to download, build and bug fix your entire project. Somewhere, you've got the word "done" used either as a method name or a key, and this does not correspond with anything in your class. I'd start with looking at your actions as connected in interface builder. – jrturton Jun 20 '12 at 11:09

6 Answers6

71

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.

Phillip Mills
  • 30,888
  • 4
  • 42
  • 57
  • 5
    yep..This is the answer,most probably you might have connected something in your Viecontroller which is deleted from .h and .m – Nithin M Keloth Jan 02 '13 at 10:41
  • Yes, this was the cause for me. Thank you – Gibberish Mar 08 '16 at 10:50
  • Helped me find the problem. I had renamed a property that was an outlet and needed to update the storyboard to match. – Chuck Krutsinger Aug 23 '16 at 23:36
  • @Phillip Mills, can you please have a look at this other question regarding `NS[whatever]UsageDescription` keys? https://stackoverflow.com/q/53710674/4124574. I believe you posted something similar in the Apple Developer forum here (https://forums.developer.apple.com/message/196093#196093) and I'd really need a pointer in the right direction. – Mig82 Dec 12 '18 at 12:40
  • This helped me too, plus Xcode said in the line above this terminating error 'Unknown class MyCustomViewController in Interface Builder file'. I realized I hadn't specified the 'Module' for the custom class! Woops! – jannamcl May 19 '21 at 23:03
36

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.

kaskader
  • 1,931
  • 16
  • 24
4

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.

Sauvik Dolui
  • 5,520
  • 3
  • 34
  • 44
0

I have encountered the same problem, I used a xib for the viewcontroller but then I deleted it. However in the code,the connection still get connections from the deleted xib. So the way to walk around is create a new xib for the viewcontroller. Then problem solved.

0

In my case it was some weird cache on xcode, even with all the removed references to the IBOutlets was still making it crash. IBOutlets were pointing to a older version of my file so not even removing and adding back files or removing all referencing outlets from my nib worked...

SOLUTION: closing xcode made the trick, also cleaning/deepCleaning the project might have helped.

user2387149
  • 1,219
  • 16
  • 28
-2

For my situation I added -all_load in "Other Linker Flags" to prevent Xcode from stripping my library binary code.

Brian
  • 14,610
  • 7
  • 35
  • 43
lorry lee
  • 11
  • 3