Updated core data concurrency documentation?
The only (and most recent) results I'm finding about best practices are here: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreData/Articles/cdConcurrency.html
However, the very top of the page says,
"Important: Best practices for concurrency with Core Data have changed dramatically since this document was written; please note that this chapter does not represent current recommendations."
Where can I find more current documentation for concurrency with core data?
The best discussion is now under 'Concurrency' within the NSManagedObjectContext documentation.
Thread confinement is still required. The big changes introduced by iOS 5/OS X v10.7 were that contexts can now have other contexts as parents and can manage their own serial queues.
Changes are automatically migrated from children to parent upon a save. That's now what save means. Only if your parent is the persistent store are you actually committing to disk.
So all that stuff about synchronising by notifications is what Apple doesn't want you to follow. All of those mechanisms are still available but Apple has pulled the most common patterns directly into the framework.
The Core Data Programming Guide has been updated for iOS 9/OS X El Capitan. See https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Conceptual/CoreData/Concurrency.html.
I also found WWDC 2014 session 225 What's new in Core Data (at 22:50) very helpful in understanding both current and historic concurrency methods.
Thread confinement has been obsoleted. You can see this in the header for NSManagedObjectContext:
NSConfinementConcurrencyType = 0x00, /* this option is obsolete and not recommended for new code. */
When a context is created with -init, it calls the initializer -initWithConcurrencyType: with the argument NSConfinementConcurrencyType. This is the threading model described in the Core Data Programming Guide section on concurrency, that has been obsolete and not recommended for some time. In the words of one Core Data engineer "It just didn't work.".
Unfortunately that Core Data Programming Guide has not been updated to describe the current recommended best practices for concurrency and other advancements. But hey, at least it's not telling you to use locking!
The Incremental Store Programming Guide has been updated recently. It describes how to implement an NSIncrementalStore, and in doing so does a very good job of explaining some of Core Data's internals. For example, it describes what a fault is and how faults are fired far better than the Core Data programming guide ever did. The Core Data release notes for the past several years have included some updated information about best practices, and there are several tech notes that are relevant to Core Data.
The best information in the last several years has been the yearly "What's New In Core Data" sessions at WWDC. For concurrency, you should check out these WWDC sessions:
WWDC 2011 What's new in Core Data on MacOS X. The MacOS X session was a little more detailed than the iOS session.
I would encourage you to use the "Feedback" button on the Core Data Programming Guide pages, or file a radar bug asking for the documentation to be updated.
The guide that I've been following is here: http://www.cocoanetics.com/2012/07/multi-context-coredata/ Even though it was written in 2012 it still seems to match what i've seen currently being used. It helps you set up a main parent context with NSMainQueueConcurrencyType, multiple background contexts with NSPrivateQueueConcurrencyType, and also has a background writer context that has the persistent store.
XCode 6 and Yosemite also seem to have an improvement in core data debugging: http://oleb.net/blog/2014/06/core-data-concurrency-debugging/. This was useful in understanding how to use performBlock at the right places.