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.

This applies both to explicit deletions performed by -[NSManagedObject deleteObject:], and implicit deletions resulting from the action of a Cascade Delete Rule when a related object is deleted.

Because it may be difficult to keep track of when the certain operations are going to be performed, re-inserting deleted objects is not recommended."

***

I'll file the above as a bug report next week. Anyone who can further clarify, please reply.

For my application, where I am deleting a parent and have children cascade-deleted, I added some extra code to make a collection of children that I don't want delete before deleting their parents, move these children to a temporary "foster parent", delete the old parents, then move the children to their new parent.

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to