iPhone iOS how to merge Core Data NSManagedObjectContext?

前端 未结 3 1559
挽巷
挽巷 2021-02-04 21:11

I\'m trying to download some JSON objects in the background and am doing quite a bit of multi threading. Once the operation completes, I noticed that this assertion fails:

3条回答
  •  花落未央
    2021-02-04 21:55

    Your particular situation (downloading JSON in the background) is quite common. I have seen a number of implementations that make do without multiple contexts.

    In many cases, the simplest and by far the robustest way is to have the objects that do the downloads notify the main thread via protocol or notification of a finished download. You then do the saving on the main thread.

提交回复
热议问题