Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
- Subject: Re: NSNull vs nil in NSManagedObject setValue: v forKey: k
- From: Quincey Morris <email@hidden>
- Date: Mon, 1 Mar 2010 00:57:52 -0800
On Mar 1, 2010, at 00:12, Eagle Offshore wrote:
> But in general, KVC requires object wrappers for things you can't put into containers.
In general (that is, in generic methods like valueForKey: and setValue:forKey:), KVC requires object pointers for values. It has nothing to do with containers -- the same is true for simple property values too.
So, KVC has to convert scalar values to/from objects, for scalar properties. But it doesn't have to convert nil for object pointer properties, because nil is already a valid object pointer.
The only complication comes when you specify nil for the value of a scalar property (still nothing to do with collections). In that case, KVC can't do the conversion, and it's handled by the setNilValueForKey: mechanism.
> NSNull should result in nil when used KVC calls just like NSNumber results in an integer.
It doesn't, though. KVC doesn't do anything special with NSNull. NSNull is there for collections, not for KVC.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden