I've the following problem:
I have two or more persistent stores. And I have created an entity in the xcdatamodel named "House". Now I have these two files for the NSManagedObject House.
Now I want to know how do I save an instance of the entity house in a specific persistent store?
So I t开发者_如何学Pythonried to work with [NSEntityDescription insertNewObjectForName:@"House" inManagedObjectContext:context]
and [context assignObject: toPersistentStore:]
. But it didn't worked until now. Am I on the right way to do it?
Can somebody give me a hint?
Answering my own question:
The problem was that I allocated a completely new persistentStoreCoordinate who coordinates all the stores. So the coordinator wasn't linked to the managedObjectContext.
Could be solved with
__persistentStoreCoordinator = [__managedObjectContext persistentStoreCoordinator];
精彩评论