Re: Re-establishing KVO in Managed objects after undo
Re: Re-establishing KVO in Managed objects after undo
- Subject: Re: Re-establishing KVO in Managed objects after undo
- From: Dave Fernandes <email@hidden>
- Date: Sat, 1 May 2010 12:34:57 -0400
There's no easy way to do this. But if you are observing other managed objects, you might be able to use
+(NSSet*)keyPathsForValuesAffecting<Key> instead. (Search for "registering dependent keys" in the docs.)
If you are observing something that is not part of your data model, you might try using mechanisms other than KVO to keep your data model updated. KVO can be a world of hurt when used the way you are using it. There are old threads on this topic. See, for example, "Strange NSManagedObjectContextObjectsDidChangeNotification behavior".
Dave
On 2010-05-01, at 9:42 AM, Gideon King wrote:
> Hi, I have some places in my code where I have managed objects that need to observe various key paths. If one of these objects has been deleted by the user, and then they undo, I need to re-establish the KVO.
>
> As undo doesn't call awakeFromFetch, I need to do this somewhere else. I have awakeFromSnapshotEvents: implemented for 10.6+ users, and it works fine, but is only available in 10.6, whereas I need to also have something that will work on 10.5.
>
> How did you accomplish this before 10.6?
>
>
> TIA
>
> Gideon
>
>
>
>
>
>
> _______________________________________________
>
> 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
_______________________________________________
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