Core data and disabling undo registration
Core data and disabling undo registration
- Subject: Core data and disabling undo registration
- From: Gideon King <email@hidden>
- Date: Mon, 18 Jul 2011 10:12:23 +1000
Hi all, in the documentation "Using Managed Objects", it says that we should use:
[moc processPendingChanges]; // flush operations for which you want undos
[[moc undoManager] disableUndoRegistration];
// make changes for which undo operations are not to be recorded
[moc processPendingChanges]; // flush operations for which you do not want undos
[[moc undoManager] enableUndoRegistration];
When disabling undo registrations, but in the example code for both Adding a Department Object, and A Sheet for Creating a New Employee, it uses:
[[managedObjectContext undoManager] disableUndoRegistration];
// Do stuff
[managedObjectContext processPendingChanges];
[[managedObjectContext undoManager] enableUndoRegistration];
(i.e. it only does a processPendingChanges once instead of twice)
I was doing some performance tuning of my application and it appeared that the processPendingChanges is a moderately expensive operation, even when there are basically no pending changes, so I tried removing the first processPendingChanges as per the examples, and it still seems to be working correctly.
Does anyone know of any reason why the first processPendingChanges would be necessary?
If not, I'm thinking that I should file a bug report against the "Using Managed Objects" documentation.
Regards
Gideon
_______________________________________________
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