Skip navigation.
 
mlCore Data: consequences of disabling the undoManager
FROM : Brian Williams
DATE : Fri Feb 08 23:31:38 2008

Hi am looking for a bit of design / api advice.

I am working on a drawing application (of sorts) that uses Core Data to store
the objects, and I am using Core Animation for the presentation layer. I have a
controller that updates both the UI objects and the managed objects, so that
they are in sync.

I have had big problems with CD and undo. The core of the problem is that when
undo/redo happens I have no idea what happened, so my controller can't do it's
job.  I tried to observe the managed objects, but it was too difficult to get
fine grained notifications of the changes, and more importantly if you undo to
a time before the object existed your observer is gone.

I have tried throwing away the entire view graph and rebuilding when undo
happens, but that (as you can Imagine) doesn't work so well :)

SO, I am thinking that I will forgo the life fulfilling connivence that is
magic undo support and undo it my self.

What is the safest way to turn off undo in Core Data?

I have tried setting the managedObjectContext's undoManager to nil in the
persistantdocuement init.

This appears to work, but my document seems to be out of sync when I save, or
worse sometimes its completely empty! I guess this is not the safest thing to
do.

If I use a different undo manager then I have to make the menu items function
nicely, I guess that's not a big deal. Will this also cause problems?

Any advice appreciated.

Thanks
Brian

Related mailsAuthorDate
mlCore Data: consequences of disabling the undoManager Brian Williams Feb 8, 23:31
mlre: Core Data: consequences of disabling the undoManager Ben Trumbull Feb 9, 00:45
mlRe: Core Data: consequences of disabling the undoManager Mark Piccirelli Feb 9, 01:27