Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Kapthehat

macrumors member
Original poster
Jul 1, 2013
51
0
Hello,

I have a datepicker on my XIB labelled "BIDDatePickerViewController" and a class of the same name. Yet when I run the app on the simulator, I get a message stating:-

"NSUnknownKeyException', reason: '[<BIDDatePickerViewController 0x762a5b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key datepicker.'

What am I doing wrong ? thanks

regards

Kaps
 
Last edited:
Hello,

I have a datepicker on my XIB labelled "BIDDatePickerViewController" and a class of the same name. Yet when I run the app on the simulator, I get a message stating:-

"NSUnknownKeyException', reason: '[<BIDDatePickerViewController 0x762a5b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key datepicker.'

What am I doing wrong ? thanks

regards

Kaps

Cocoa has some simple naming conventions that you should follow.

Never use the same name for both a class and an instance variable/property/local variable.

Class names should start with an upper case letter, and method names, properties, instance variables, and local variables should start with a lower case letter.

Using the same names for both classes and instance variables might not be causing your problem, but it is certainly making it harder to figure out.

There is a refactor command in Xcode that will change a name globally. Use that to clean up your naming.

The "...this class is not key value coding-compliant for the key..." error usually means that you set up and IBOutlet link in IB, then later renamed the outlet, so IB is trying to set up a link to an instance variable or property that doesn't exist any more. Break the outlet link "datepicker" in IB and then re-link it with the correct instance variable/property. That should fix the error.
 
resolved -classes not value compliant.

thanks - your idea of breaking and rebuilding all the connections worked !!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.