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

DVD Plaza

macrumors member
Original poster
Jan 12, 2008
70
89
adelaide.sa.au
I've bound an NSDatePicker to a date attribute in one of my Core Data entities via an NSArrayController.

This causes the following errors in the debugger console whenever the value is triggered:

Code:
2008-01-13 10:24:42.360 Ziggy[14788:10b] Error setting value for key path selection.lastActivity of object <NSArrayController: 0x139280>[entity: IOControllers, number of selected objects: 1] (from bound object <NSDatePicker: 0x12fd50> with object ID 404 in Nib named MainMenu.nib): [<NSManagedObject 0x1e0460> setValue:forUndefinedKey:]: the entity IOControllers is not key value coding-compliant for the key lastActivity.

All my other attributes work just fine, it's only the date attribute that's failing but I can't for the life of me work out why. I've even resorted to Apple's own Core Data videos, which cover using a date attribute with an NSDatePicker, but other than all of Apple's documentation still covering Xcode 2.x instead of 3.0 they don't do anything different to what I have.

I'm using Xcode 3 and Leopard - has something changed that is breaking this?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Well it seems like the last part of the error describes perfectly the problem:
...the entity IOControllers is not key value coding-compliant for the key lastActivity.

Are you sure you bound it to the right object?
 

DVD Plaza

macrumors member
Original poster
Jan 12, 2008
70
89
adelaide.sa.au
Well it seems like the last part of the error describes perfectly the problem?
You'd think so, I've been bashing my head against the wall telling myself I've done something stupid, yet for the life of me cannot see why that would be a problem... it's an NSDatePicker against a Date attribute, they're compatible! I've even tried going as far as shoving a Date Formatter against it, as redundant as that might be, to no avail. It just doesn't seem possible that key value coding-compliant could be anything to do with it.

Yet the other aspect of the error, forUndefinedKey, shouldn't be a problem either... I've simply bound the object to my lastActivity entity... what's so hard about that!?! :confused:

Edit:
Are you sure you bound it to the right object?

I've simply bound the object to my lastActivity entity... what's so hard about that!?! :confused:

OMG!!! I bound my NSDatePicker to lastActivity, but in my entity I had a typo in my attribute... lastActivty! No wonder I couldn't spot it!!! Nuked my old data file, since this has changed the structure, and it's working a charm!

Thanks kainjow, you WERE a big help - doubting myself wasn't good enough, you questioning me finally made me spot it!
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Cool, glad you got it working.

And this is why I'm not a big fan of KVC. It is too easy to mess up and no way for the compiler to check.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.