I am trying to migrate some code to use an NSManagedObjectContext with NSPrivateQueueConcurrencyType.
I\'m sometimes getting very odd error
Working with XCode 8.x and iOS 10.x, I wanted to provide a streamlined answer for anyone wanting to implement this now.
You will first need to modify the scheme for your app:
Once you select Scheme, select Edit Scheme which should appear near the bottom of your list:
When opened, make sure that you have Run selected and choose Arguments. You will want to copy the following values in:
-com.apple.CoreData.ConcurrencyDebug 1-com.apple.CoreData.Logging.stderr 1Your screen should look like this:
After launching the app, you should see this appear in your console now when those options are enabled:
CoreData: annotation: Core Data multi-threading assertions enabled.
And when you run into an exception generated by this, you will likely see this:
CoreData`+[NSManagedObjectContext Multithreading_Violation_AllThatIsLeftToUsIsHonor]:
You can return to the scheme editor and disable this logging as needed to prevent exceptions in the future.