我有一个 NSPersistentDocument,我正在将其默认 MOC 替换为具有 NSPrivateQueueConcurrencyType
的 MOC,这可以很好地保持操作脱离主线程。
但是,我是否还需要使用 NSMainQueueConcurrencyType
创建一个子 MOC?如果需要的话,它的用途是什么?
最佳答案
Apple 关于此主题的文档不是很明确,也不是最新的。核心数据编程指南指出:core data programming guide
The pattern recommended for concurrent programming with Core Data is thread confinement: each thread must have its own entirely private managed object context. [...] You must create the managed context on the thread on which it will be used.
关于objective-c - 何时需要将 NSManagedObjectContext 与 NSMainQueueConcurrencyType 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17517742/