【发布时间】:2014-10-23 12:21:19
【问题描述】:
在带有 NSManagedObjectContext 的核心数据中:如果我有父上下文和子上下文,当我保存子上下文时,是否还需要保存父上下文?
即
NSManagedObjectContext *childContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType];
childContext.parentContext = [self defaultPrivateQueueContext];
[childContext performBlock:^{
//do stuff async
[childContext save:&error];
[self.defaultPrivateQueueContext performBlock:^{
[self.defaultPrivateQueueContext save:&error];
}];
}];
【问题讨论】:
标签: xcode core-data nsmanagedobjectcontext