On Sat, Nov 19, 2011 at 6:49 PM, Roland King <r...@rols.org> wrote: > > On Nov 20, 2011, at 5:48 AM, Jerry Krinock wrote: > >> >> On 2011 Nov 16, at 17:16, Tom Harrington wrote: >> >>> I'm finding that if I use nested managed object contexts, >>> awakeFromInsert will be called twice on new objects. >> >>> I'm wondering if this is a Core Data bug or a documentation bug. >> >> I'd say it's a pretty serious Core Data bug. I've not had an occasion to >> use nested managed object contexts yet, but I put things in -awakeFromInsert >> that I only want to happen once. >> > > It's certainly not explicitly documented, however a quick scan of the iOS > forums finds another 3 developers who've discovered the same thing. Is it > really the same object however? It can't be, right, they have different > addresses, so Core Data is arguably doing what the documentation says, it's > calling awakeFromInsert only once in the object's lifetime, you just have two > objects, one in each context.
Actually I don't, so far as I can tell. As I mentioned in my previous message, I get the same managed object ID both times. I haven't checked the address, but surely if they were different objects they wouldn't have the same ID. > What does the object look like when you get the second call? Has Core Data > literally just created it in the second MOC and is calling awakeFromInsert on > it before (I assume) populating the data on it from the original, or is it > already a clone of the first, with properties and relationships set on it? If > the former that seems not too inconsistent, new object in new store gets > called to set up defaults before the properties you set on it are cloned > over, if the second case, that's much harder to deal with (and sounds like a > bug) The object appears the same both times-- a new object with no properties or relationships set. -- Tom Harrington atomicb...@gmail.com AIM: atomicbird1 _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com