• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Core data and disabling undo registration
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Core data and disabling undo registration
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: strange NSTextView problem
  • Next by Date: Need help debugging this
  • Previous by thread: simple multipart upload implementation
  • Next by thread: Re: Core data and disabling undo registration
  • Index(es):
    • Date
    • Thread