Re: awakeFromInsert called twice with nested contexts
Re: awakeFromInsert called twice with nested contexts
- Subject: Re: awakeFromInsert called twice with nested contexts
- From: Quincey Morris <email@hidden>
- Date: Sun, 27 Nov 2011 21:23:18 -0800
On Nov 27, 2011, at 20:50 , Tom Harrington wrote:
> If they're different objects then I'm getting duplicates, which is at
> least as much of a bug and possibly more so. What I observe is that if
> I add 10 objects, I get 20 calls to awakeFromInsert, 10 for the child
> context and 10 for the parent. But, there are only 10 unique managed
> object IDs. It might be that I just happen to be getting the same IDs
> for two completely different sets of objects, but there shouldn't be
> two sets in the first place.
Objects are specific to a managed object context, so it's correct that there would be 20 objects, and it's correct that there would be only 10 object IDs.
For any given "row" in the persistent store, there will be one object *per managed context* in memory. The set of objects that correspond to the row all have the same object ID -- that's what object IDs are for. All of the numbers you're quoting are consistent:
1 persistent store
2 managed object contexts
10 rows to be inserted in the persistent store (when the MOCs are eventually saved)
10 object IDs, one per row
20 object instances, one per row per managed object context_______________________________________________
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