I've found the workaround, at least.

Objects are in a tree formation with parent and children relationships.  Delete 
Rule is Cascade.

Steps to reproduce:

• Open a particular document which contains 4 objects
    Root1
       OldObject2
       OldObject3
       OldObject4
• Insert 3 new objects, so the tree is now
    Root1
       OldObject2
       OldObject3
          NewObject5
          NewObject6
             NewObject7
       OldObject4
• Save
• Delete the 3 new objects
• Save
• Undo

The trick is the order in which they are deleted.  If the child NewObject7 is 
deleted before its parent NewObject6, Undo will succeed.  If the parent is 
deleted first, Undo will fail.  In my app, the order is random due to 
enumerating an NSSet.

I think I remember seeing, when looking at the invocation on the undo stack 
earlier today, in that NSKnownKeysDictionary1, that the 'parent' relationship 
of the un-restorable object was null.  But all properties in my data model are 
optional.  Been there and done that with Core Data's validation :(

Some stumpers:

• If I consolidate the first three steps, opening a document which already 
contains all 7 objects, Undo always succeeds.
• If I skip the second Save step, Undo always succeeds.

_______________________________________________

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

Reply via email to