Re: -awakeFromInsert can run > once. (Was: Removing object as observer…)
Re: -awakeFromInsert can run > once. (Was: Removing object as observer…)
- Subject: Re: -awakeFromInsert can run > once. (Was: Removing object as observer…)
- From: Jerry Krinock <email@hidden>
- Date: Mon, 31 Mar 2014 08:14:14 -0700
On 2014 Mar 31, at 02:29, Dado Colussi <email@hidden> wrote:
> I don't start observers in -awakeFromInsert or -awakeFromFetch. I start them on demand, and in -awakeFromSnapshotEvents: with NSSnapshotEventUndoDeletion (I ignore the other flags). I think the best place to start observers depends on how the objects are used.
Dado, the “question” in my previous message was not posed to you personally, just posing a situation that anyone might be in. I’m sorry for the confusion.
Anyhow, it looks as though, contrary to documentation, -awakeFromInsert can be re-run on an object during -[NSManagedObjectContext rollback]. There are some instances where such a second run for -awakeFromInsert would cause unexpected results. However, maybe this is not a concern because, at least in my apps I never explicitly invoke -[NSManagedObjectContext rollback]. Does anyone know of a situation in which Cocoa would invoke -[NSManagedObjectContext rollback] internally?
_______________________________________________
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