zevij
zevij

Reputation: 2456

Is the default behaviour for NSManagedObjectContext save() method a blocking method?

To be very specific: If I get the managed object context from the app delegate and do not set any parameters on it, what happens when running inserts, updates followed by save()?

Does the app block on save() until done?

Upvotes: 1

Views: 428

Answers (2)

zevij
zevij

Reputation: 2456

This what it came down to: Normally, when I create an object, I only set the main key (properties that don't change through the lifecycle of the object) on creation. I then use an update method to complete the creation. In this particular case, I changed one property on the server from 'creational' property to 'updateable' property, but I missed it in the app. So the app was deleting the objects only to have the server create them again a bit later...

Upvotes: 0

Tom Harrington
Tom Harrington

Reputation: 70986

Yes, the save method blocks. It's not even a default-- that's how it is, always. Does't matter if the context came from the app delegate or somewhere else, save is a synchronous method.

Upvotes: 3

Related Questions