NSManagedObjected isInserted
Can anybody ever think of a scenario where [NSManagedObject isInserted] equals NO for an object that is initially fetched from the context? And no the object has not been deleted from the context prior to calling isInserted. ___ 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
Re: NSManagedObjected isInserted
On Apr 10, 2011, at 06:52, Carter R. Harrison wrote: > Can anybody ever think of a scenario where [NSManagedObject isInserted] > equals NO for an object that is initially fetched from the context? And no > the object has not been deleted from the context prior to calling isInserted. What do you mean by "initially fetched"? The object should return YES for "isInserted" from the time it's inserted to the time the store is committed/saved. It's not clear where in this timeline your "initially" is pointing. ___ 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
Re: NSManagedObjected isInserted
On Apr 10, 2011, at 1:29 PM, Quincey Morris wrote: > On Apr 10, 2011, at 06:52, Carter R. Harrison wrote: > >> Can anybody ever think of a scenario where [NSManagedObject isInserted] >> equals NO for an object that is initially fetched from the context? And no >> the object has not been deleted from the context prior to calling isInserted. > > What do you mean by "initially fetched"? The object should return YES for > "isInserted" from the time it's inserted to the time the store is > committed/saved. It's not clear where in this timeline your "initially" is > pointing. > I'm creating and NSManagedObject with [NSManagedObject initWithEntity:insertIntoManagedObjectContext:] and for the context I'm passing nil. Later I call [NSManagedObjectContext insertObject:] and pass in the same NSManagedObject that was initialized earlier. On a subsequent run of my application I fetch the object from the store and call [NSManagedObject isInserted]. Without fail it always returns NO. ___ 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
Re: NSManagedObjected isInserted
On 2011 Apr 10, at 11:52, Carter R. Harrison wrote: > On Apr 10, 2011, at 1:29 PM, Quincey Morris wrote: > >> The object should return YES for "isInserted" from the time it's inserted to >> the time the store is committed/saved. > > On a subsequent run of my application I fetch the object from the store and > call [NSManagedObject isInserted]. Without fail it always returns NO. If you read Quincey's post, he answers your question … after the store has been saved, its new objects return NO to -isInserted. The documentation for -isInserted makes no mention of this. But it wouldn't be the first time that Quincey was better than documentation. ___ 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
Re: NSManagedObjected isInserted
On 10 Apr 2011, at 19:52, Carter R. Harrison wrote: > > On Apr 10, 2011, at 1:29 PM, Quincey Morris wrote: > >> On Apr 10, 2011, at 06:52, Carter R. Harrison wrote: >> >>> Can anybody ever think of a scenario where [NSManagedObject isInserted] >>> equals NO for an object that is initially fetched from the context? And no >>> the object has not been deleted from the context prior to calling >>> isInserted. >> >> What do you mean by "initially fetched"? The object should return YES for >> "isInserted" from the time it's inserted to the time the store is >> committed/saved. It's not clear where in this timeline your "initially" is >> pointing. >> > > I'm creating and NSManagedObject with [NSManagedObject > initWithEntity:insertIntoManagedObjectContext:] and for the context I'm > passing nil. Later I call [NSManagedObjectContext insertObject:] and pass in > the same NSManagedObject that was initialized earlier. > > On a subsequent run of my application I fetch the object from the store and > call [NSManagedObject isInserted]. Without fail it always returns NO. Think of it as being equivalent to: - (BOOL)isInserted; { return [[[self managedObjectContext] insertedObjects] containsObject:self]; } Thus, objects only return YES when inserted into a context and not yet persisted.___ 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
Re: NSManagedObjected isInserted
On 2011 Apr 11, at 06:00, Mike Abdullah wrote: > Think of it as being equivalent to: > > - (BOOL)isInserted; > { >return [[[self managedObjectContext] insertedObjects] containsObject:self]; > } Oh! Thank you for clarifying that, Mike. I just sent Apple some Document Feedback on -isInserted. ___ 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