Unexplainable Crash

Good Day,

The app that I’m currently making has similar code to the MyLocations Tutorial. I was trying to solve the issue of the keyboard not dismissing even with the appropriate code and settings in Storyboard(“Dismiss on drag”), so I decided to remove a connection from a UITextView object and repeat the steps of making a connection which unfortunately resulted in the app crashing upon launching.

Below is what appears in the console, the bolded sentence is what I assume to be more relevant :

2016-03-05 19:14:23.981 Stray[1560:73978] *** Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: '[<Stray.CurrentViewController 0x7f8a80da8660> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key conditionTextView.’

libc++abi.dylib: terminating with uncaught exception of type NSException

Looking at the bolded sentence I assume it has something to do with the dictionary value for conditionTextView, but what does coding-compliant mean?

Thanks for reading :slightly_smiling:

Somewhere in your storyboard is a view controller with an outlet for ‘conditionTextView’. Perhaps the view controller used to have a property called ‘conditionTextView’ and you deleted it in code, but because the outlet was connected in the storyboard, the storyboard didn’t delete the outlet, so they’re out of sync. When the view controller is instantiated from the storyboard, it expects there to be a property called ‘conditionTextView’ to connect to and this causes an exception.

The term you’re not following isn’t ‘coding-compliant’, it’s ‘key value coding-compliant’. Key Value Coding, sometimes called KVC, is basically the storyboard thinking of your class as a dictionary, with the class’s property names as keys and their values as values. So ‘conditionTextView’ is a property and the UITextView I assume it used to connect to was its value.


@narrativium Thank you so much for the fast reply, I’ve found out where the unnecessary ‘conditionTextView’ was that existed due to a silly mistake of mine. Thank you for explaining KVC :+1:, at least I learnt something new thanks to my silly mistake.