• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT!


  • Subject: Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT!
  • From: Adam Swift <email@hidden>
  • Date: Fri, 8 May 2009 14:10:22 -0700


On May 8, 2009, at 1:00 PM, Jerry Krinock wrote:

Conclusion. Here's what I believe to be the "missing documentation"...

***

"You can use -insertObject: to cancel a prior deletion, however if certain operations are performed after the deletion and before the restoring -insertObject:, the attributes of the deleted/inserted object will all be set to nil. These certain operations include, but may not be limited to,

  -[NSManagedObjectContext executeFetchRequest:error:]
  -[NSManagedObjectContext save:]

Regarding the former, note that the deleted objects need not be (and will not be, because they are deleted) included in the fetch results in order to have their attributes hosed.



That looks correct and a bug report/documentation enhancement request is reasonable, but note that deleted objects will only have their attributes cleared if:
(a) the object is newly inserted (doesn't exist in the persistent store) and
(b) no 'undo tracking event (ie user event)' occurs between the creation/insert and subsequent delete. You can trigger the same effect of an undo event boundary by calling "processPendingChanges".


- adam

_______________________________________________

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


References: 
 >NSManagedObjectContext -insertObject: Cancels Prior Deletion? (From: Jerry Krinock <email@hidden>)
 >Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion? (From: Dave Fernandes <email@hidden>)
 >Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT! (From: Jerry Krinock <email@hidden>)
 >Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT! (From: Alexander Spohr <email@hidden>)
 >Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT! (From: Jerry Krinock <email@hidden>)
 >Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT! (From: Jim Correia <email@hidden>)
 >Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT! (From: Jerry Krinock <email@hidden>)
 >Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT! (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT!
  • Next by Date: Re: NSString to bit pattern
  • Previous by thread: Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion -- BUT!
  • Next by thread: Re: how to combine addObject in mutablearray with Object instantiation?
  • Index(es):
    • Date
    • Thread