I am working on an application where the user can edit some entries manually, but they can also be updated from the server.
For custom updates, I use UndoManager to allow the user to undo / confirm the change group. When the user goes into edit mode, I do:
[[self.contact.managedObjectContext undoManager] beginUndoGrouping];
[[self.contact.managedObjectContext undoManager] endUndoGrouping];
[[self.contact.managedObjectContext undoManager] undo];
[[self.contact managedObjectContext] save:nil];
For automatic updates from the server (the object can be modified by the server) I use the parent MOC. The one above, which I use to control edit mode, is the parent. I create a child MOC and in the background change the data from the server. At the end of the process, I do:
[self.moc.save:nil];
[self.moc.parentContext.save:nil];
, , , UNDO - , , .
:
. , MOC, .