• 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?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion?


  • Subject: Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion?
  • From: Alexander Spohr <email@hidden>
  • Date: Tue, 5 May 2009 09:14:54 +0200


Am 05.05.2009 um 07:44 schrieb Jerry Krinock:

I have a tree of managed objects with parent <--> child relationships, and Delete Rule set to Cascade children when a parent is deleted.

But sometimes, after deleting a parent, I need to restore a deleted child under a new parent. So I set the new relationships and also send

  [managedObjectContext insertObject:deletedObject] ;

It appears that -insertObject: "cancels" the object's previous Cascade-deletion. It definitely does not persist as desired if I don't to this.

Is what I'm doing OK?

I’d say no.

You can not re-insert a deleted object because it is unique in the database and as such dead and gone after deletion.

Either hang your object onto the new parent before deleting the old parent, or copy it’s data to a new object that you can then insert.

	atze


_______________________________________________

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>)

  • Prev by Date: Exception
  • Next by Date: Re: Integer as key in NSMutableDictionary
  • Previous by thread: NSManagedObjectContext -insertObject: Cancels Prior Deletion?
  • Next by thread: Re: NSManagedObjectContext -insertObject: Cancels Prior Deletion?
  • Index(es):
    • Date
    • Thread