Skip navigation.
 
mlRe: Cocoa-dev Digest, Vol 2, Issue 490
FROM : Jack
DATE : Sat Apr 09 01:25:40 2005

> If foo has no "blob" accessor, then [foo blob] throws a warning at
> compile time, while [foo valueForKey:@"blob"] does not, instead
> erroring at runtime.


I don't really understand what all the complaining is about.  What is the
problem with runtime? This is what "(id)valueForUndefinedKey:(NSString
*)key" is all about. You can print out an error and the key letting you know
exactly where the problem is and return NIL, it's good practice to check for
NIL and act appropriately. You can even tell the bindings what to do with
NIL. One good thorough run of your program will quickly show any errors as
well. I don't know about you but I run and test every implementation of
something right after I code it, so it doesn't even involve an extra step
for me.

Also there no reason to use KVC with core data. You can go ahead an use your
own accesor method directly and forget about KVC, just like you can with all
objects that comply with the KVC protocol.  This is what I love about Cocoa
there so many levels to it.  You can take care of things at the accesor
method at the delegate, at the notification, with KVC...

Related mailsAuthorDate
mlRe: Cocoa-dev Digest, Vol 2, Issue 490 Jack Apr 9, 01:25
mlRe: ADC Core Data article (was: Re: Cocoa-dev Digest, Vol 2, Issue 490) Scott Ellsworth Apr 9, 09:33