且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

核心数据并发 - 收集在枚举期间发生了变化

更新时间:2022-03-28 21:54:19

一个上下文,如果您对核心数据对象执行并行操作,那么这是错误的。你应该每个线程有一个上下文,并在每次保存时合并上下文。 Apple的核心数据指南更详细地讨论了这一点。

You seem to be using only one context, which is wrong if you have parallel operations executing on your core data objects. You should have a context per thread and merge the contexts every time you save. Apple's Core Data Guideline talks about this in more detail.