I had this problem and it looks like I solved it. I do not know what I did for sure. I mean, I did a couple of things and donβt know which one was the solution. So Iβll just describe ...
I reworked my code to follow some βhintsβ found in white papers and on some forums:
- If you are managing an
NSManagedObjectContext in another thread, it must be created in that thread and not passed in there somehow. - You should add an observer (to receive save notifications for merging) only in the main stream - this way they will also be merged into the main stream.
- (Optional, but I did it). You can try to save the context in the main thread, even if it was created and managed in the background thread.
1 and 3 are more like some βmagicβ, so I think you should try to follow 2 first. Hope this helps you.
source share