Background fetching with Core Data

Sebastian Rehnby:

When using Core Data, each managed object context should be confined to a single thread. In order to use managed objects on the main thread, they need to be fetched by a context confined to the main thread. The problem with that is that any use of executeFetchRequest: on that context will block the main thread while fetching the objects from disk, which will inevitable block your app’s UI.

Sebastian writes an example using a category on NSManagedObjectContext to add an asynchronous call to fetch into shared persistent store in a background thread.