O'Reilly logo

Core Data in Swift by Marcus S. Zarra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Debug Concurrency Checking

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:

  1. Edit the schema ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required