Skip to Main Content
Core Data in Objective-C, 3rd Edition
book

Core Data in Objective-C, 3rd Edition

by Marcus S. Zarra
June 2016
Beginner to intermediate content levelBeginner to intermediate
240 pages
6h 17m
English
Pragmatic Bookshelf
Content preview from Core Data in Objective-C, 3rd Edition

Asynchronous Saving

One of the biggest issues with threading and Core Data has to do with thread blocking. No matter how cleverly you write the import and export operations, sooner or later you need to block the main queue to let the main NSManagedObjectContext talk to the NSPersistentStoreCoordinator and save changes out to disk.

Fortunately, this is a solvable problem and requires a small change to the Core Data stack. If you start your Core Data stack with a private queue, NSManagedObjectContext, and associate it with NSPersistentStoreCoordinator, you can have the main NSManagedObjectContext as a child of the private NSManagedObjectContext. Also, when the main NSManagedObjectContext is saved, it won’t produce a disk hit and will instead be ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

iOS Programming Cookbook

iOS Programming Cookbook

Hossam Ghareeb
Learning Cocoa with Objective-C, 4th Edition

Learning Cocoa with Objective-C, 4th Edition

Paris Buttfield-Addison, Jonathon Manning, Tim Nugent

Publisher Resources

ISBN: 9781680502022Errata Page