Re: KVO and Core data
Re: KVO and Core data
- Subject: Re: KVO and Core data
- From: Gideon King <email@hidden>
- Date: Mon, 9 Aug 2010 22:42:51 +1000
The objective is for me to be notified when "toOne.attribute" changes (either by toOne changing or by the attribute changing).
Surely what I am doing is not getting the NSManagedObject to observe itself, but rather the observer is self and the "observee" is the to one relationship and it's attribute.
If I made it [toOne addObserver:self forKeyPath:@"attribute" options:0 context:NULL], then I would have to separately keep track of when toOne changed, and update the observers, and also this is a simple case - sometimes I need to do "toOne.toOne.attribute".
Or maybe I'm missing something in how KVO works with key paths...
Gideon
On 09/08/2010, at 9:24 PM, Michael Swan wrote:
> Gideon,
> It looks like you have an NSManagedObject that is observing itself. If this is in fact the case what is the objective? There may be a better way to accomplish your goal if you let us know what it is.
>
>>
>> [self addObserver:self forKeyPath:@"toOne.attribute" options:0 context:NULL];
>>
>>
_______________________________________________
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