Re: Core Data: first NSKeyValueObservingOptionOld is Null
Re: Core Data: first NSKeyValueObservingOptionOld is Null
- Subject: Re: Core Data: first NSKeyValueObservingOptionOld is Null
- From: "Timothy J. Wood" <email@hidden>
- Date: Tue, 3 Jul 2007 19:05:30 -0700
On Jul 3, 2007, at 5:01 PM, Ken Kania wrote:
I am using KVO and have been receiving messages that show (null) for
NSKeyValueObservingOptionOld, and then the proper value for
NSKeyValueObservingOptionNew.
I load my core data from a xml persistent store, which I can see
has the
correct value for the attribute. When I fetch this object and add an
observer for this attribute however, I receive the above KVO message.
[...]
CoreData inexplicably publishes nil->value when clearing faults and
value->nil when an object is deleted or invalidated. If you are doing
anything moderately interesting with KVO, you have to tread very, very
carefully.
I logged a bug on on this, but it came back as 'behaves correctly'.
I'm still mystified by this choice and I'm often having to fight this
issue,
so I consider this a design bug. My take on this is that an uncleared
fault is in an indeterminate state. Nil is a valid value for a property
and thus saying that an object has transitioned from nil->value is
tantamount to saying that the object has been edited.
-tim
_______________________________________________
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