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 (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