我正在阅读 Apple 的“核心数据片段”文档(https://developer.apple.com/library/mac/#documentation/DataManagement/Conceptual/CoreDataSnippets/Articles/stack.html#//apple_ref/doc/uid/TP40008283 -SW1),我在这部分有点困惑。
To create a new managed object context, you need a persistent store coordinator.
NSPersistentStoreCoordinator *psc = <#Get the coordinator#>;
NSManagedObjectContext *newContext = [[NSManagedObjectContext alloc] init];
[newContext setPersistentStoreCoordinator:psc];
If you already have a reference to an existing context, you can ask it for its persistent
store coordinator. This way you can be sure that the new context is using the same
coordinator as the existing one (assuming this is your intent):
NSManagedObjectContext *context = <#Get the context#>;
NSPersistentStoreCoordinator *psc = [context persistentStoreCoordinator];
NSManagedObjectContext *newContext = [[NSManagedObjectContext alloc] init];
[newContext setPersistentStoreCoordinator:psc];
最特别的是 <#Get the coordinator#> 和 <#Get the context#> 部分。这到底是什么意思,在实际应用程序中应该去那里?
谢谢。