3

The NSManagedObjectContext saves changes asynchronously or synchronously?

If asynchronously, then how can I wait for saving changes?

ruslan.berliner
  • 121
  • 2
  • 13

1 Answers1

4

Synchronously.

You can put any code you want to run after saving just after the save call.

The methods -(void)willSave and -(void)didSave on NSManagedObject allow you to perform behaviour on your model class after/before save.

If you're on the Mac you can also watch for a notification called NSManagedObjectDidSaveNotification

John Gallagher
  • 6,208
  • 6
  • 40
  • 75
  • Thank you John, i've just maked a question because I thought if asynchronously, then it can partially explain my another question about NSManagedObjectContext [link](http://stackoverflow.com/questions/9419048/exc-bad-access-on-nsmanagedobjectcontext-save-method-inside-nsoperation-and-arc) – ruslan.berliner Feb 25 '12 at 15:00