My own preliminary answer to this is now yes .
I initialize my background operation by passing it an instance of NSPersistentStore . In the background stream, the properties of this store, including the URL, are used to create a whole new set of Core Data as follows:
// create managed object model NSURL *modelUrl = [[NSBundle bundleForClass:[self class]] URLForResource:@"..." withExtension:@"..."]; NSManagedObjectModel *managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelUrl]; // create persistent store coordinator NSPersistentStoreCoordinator *persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:managedObjectModel]; NSError *error = nil; [persistentStoreCoordinator addPersistentStoreWithType:[store type] configuration:[store configurationName] URL:[store URL] options:[store options] error:&error]; // create managed object context NSManagedObjectContext *context = [[NSManagedObjectContext alloc] init]; [context setPersistentStoreCoordinator:persistentStoreCoordinator]; [persistentStoreCoordinator release]; [managedObjectModel release];
Then I make a background selection using this newly created instance of NSManagedObjectContext .
Everything seems to be working fine. However, I am not yet accepting my own answer, as I would like someone to provide me with supporting or conflicting evidence for my findings.
GBegen
source share