One of the issues when dealing with any kind of threading is knowing whether or not you got it right. Threading issues are tricky. Things will work in development, they’ll work in testing, and then every once in a while they stop working in production. Core Data has suffered from this problem as much as any other framework.
Fortunately, as of iOS 8 and OS X10.10 Core Data now has a solution to the problem: a debug flag that you can turn on that will cause an exception if a Core Data object is accessed from the wrong queue.
This flag can be turned on as a runtime argument and I strongly recommend that it be turned on for the debug configuration on every Core Data project.
To turn it, follow these steps: