STATEMENT OF THE PROBLEM
When I try to save a record in the read / write repository, which is one of two SQLite repositories assigned to the same PersistentStoreCoordinator, my iPhone application crashes. One of the obvious problems when saving a record - PersistentStoreCoordinator does not know in which store to save data (just because I do not know how to do it).
First I will provide a big picture to make sure my approach sounds. Then I will provide implementation details.
BACKGROUND
This is a simplified example that introduces key aspects of the real application I'm working on.

Seed data

User input script

CURRENT IMPLEMENTATION
Implementation of Master Data


, , , , .
- (NSPersistentStoreCoordinator*)persistentStoreCoordinator {
if (_persistentStoreCoordinator == nil) {
NSArray *bundles = @[[NSBundle bundleForClass:[self class]]];
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[NSManagedObjectModel mergedModelFromBundles:bundles]];
NSError *error;
NSDictionary *options = @{NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES};
NSPersistentStore *persistentStore = [_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil
URL:self.persistentStorePathForUserData
options:options
error:&error];
options = @{NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES,
NSReadOnlyPersistentStoreOption : @YES};
persistentStore = [_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil
URL:self.persistentStorePathForSeedData
options:options
error:&error];
}
return _persistentStoreCoordinator;
}
:
- , , ( Seed Data, - ) , n n + 5.
- ManagedObjectModel. , .
RESEARCH
,
,
, , . , , . (. № 2 .)
,
iOS Core?,
, - /. Seed , - /. , . (. № 2 .)
Apple, " ", 4 " " , , . .
,
SQLite ,
, , , .
, Core Data (2- ), Marcus Zarra, , . 3 . ( № 1 .)
, iPhone, ManagedObjectModel, . , , .
, NSPersistentStoreCoordinator ?, , . , . , NSFetchRequest, setAffectedStores, NSManagedObjectContext .