3
votes

Example: I have one persistent store coordinator which uses one single persistent store.

Now there are two managed object contexts, and both want to use the same persistent store. Could both simply use the same persistent store coordinator, or would I have to create two instances of NSPersistentStoreCoordinator? And if I had to, then: Would I also have to create two NSPersistentStore instances?

1

1 Answers

5
votes

The Core Data on iPhone article on ADC gives a good introduction to this topic:

In any application, you might have multiple managed object contexts. You might want to maintain discrete sets of managed objects and edits to those objects; or you might want to perform a background operation using one context while allowing the user to interact with objects in another. Each of these would be connected to the same coordinator.

A Persistent Store Coordinator is designed to handle multiple contexts