Apress Access

Pro Core Data for iOS

Data Access and Persistence Engine for iPhone, iPad, and iPod touch

By Michael Privat , Robert Warner

  • eBook Price: $27.99
Buy eBook Buy Print Book
Pro Core Data for iOS shows you how to use Apple’s Core Data framework on iPhone, iPad, and iPod touch devices. The book explains both how and why to use Core Data, from simple to advanced techniques.

Full Description

  • Add to Wishlist
  • ISBN13: 978-1-4302-3355-8
  • 400 Pages
  • User Level: Intermediate
  • Publication Date: January 27, 2011
  • Available eBook Formats: EPUB, MOBI, PDF

Related Titles

  • Appium Recipes
  • Beginning Xcode: Swift 3 Edition
  • Practical Swift
  • Migrating to Swift from Flash and ActionScript
  • Agile Swift
Full Description

The power of Core Data allows iOS developers to efficiently store and retrieve application data using familiar object-oriented paradigms. Pro Core Data for iOS explains both how and why to use Core Data for data storage, from simple to advanced techniques. Covering common and advanced persistence patterns, this book prepares any iOS developer to store and retrieve data accurately and proficiently.

Lots of iOS development books touch on Core Data, taking you through a few mainstream use cases for storing and retrieving data in your iOS applications. In Pro Core Data for iOS, however, we take you further into Core Data and show you how to leverage the power of this data framework.

After reading this book, you’ll be able to answer all of these questions:

  • What are all the parts of Core Data, and how do they interact?
  • How do I create my own custom store?
  • Should I use plain NSManagedObject instances or custom classes?
  • How do I undo and redo Core Data actions?
  • How do I filter, sort, and aggregate data?
  • What is “faulting,” and why should I care?
  • Suppose I want to change my data model; how do I migrate my users’ data?
Pro Core Data for iOS delves into these and other Core Data questions. With explanations, diagrams, code samples, and working explanations, this book will make you a Core Data pro!

What you’ll learn

  • Organize data appropriately
  • Persist data efficiently
  • Use Apple’s tools effectively
  • Build Core Data applications
  • Use Core Data in advanced settings
  • Version and migrate data as your applications evolve

Who this book is for

All iPhone, iPad, and iPod touch developers whose applications manage any amount of data.

Table of Contents

Table of Contents

  1. Getting Started
  2. Understanding Core Data
  3. Storing Data: SQLite and Other Options
  4. Creating a Data Model
  5. Working with Data Objects
  6. Refining Result Sets
  7. Tuning Performance and Memory Usage
  8. Versioning and Migrating Data
  9. Using Core Data in Advanced Applications
Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.


If you think that you've found an error in this book, please let us know by emailing to editorial@apress.com . You will find any confirmed erratum below, so you can check if your concern has already been addressed.

On page Kindle location 1341, Listing 5-8:
Listing 5-8 does not seem to follow the typeface conventions used in the book for added code. Consequently, it's unclear from the text that the user must add the category: "it is necessary to create a category and list the methods for the relationships, as shown in Listing 5-8." If Listing 5-8 showed the category in bold type, it would be more understandable.

On page 9:
space between persistentStore and Coordinator in figure 1-6. Should be persistentStoreCooridnator.

On page 68 and 70:
For TeamViewController.m on page 68 you say:

"add release calls for team and rootController to the dealloc: method."

but the dealloc: method on page 70 only calls super.

On page 85:
cannot assign self outside of the init family.


- (id)initWithMasterController:(MasterViewController *)aMasterController team:

On page 94:
On the prior page, you state that the metadata file is a plist, which would use the ".plist" file extension, and that in this example, our data file will point to the .txt file.

So on page 94 in the metadataForPersistentStoreWithURL:error: method, if the metadata doesn't exist, we need to create the new store. However, the new store file is being written to the file path created at the top of the method using the ".plist" extension. Shouldn't this be ".txt" ?

I downloaded the sample code, but its the same.

On page 145:
In Shapes application, in method -(void)createShapeAt:(CGPoint)point, in a case of creating a new polygon, there is no relationship made from each new generated vertex object, to a correlating shape object.
The problem surfaces after one or more polygon objects are created, and application is closed. After relaunching application, there is no any polygon objects displayed on the screen, and when screen orientation is changed application crashes.
I solved this problem by inserting line of code that creates relationship from each newly created vertex object to the correlating shape(polygon) object.
[vertex setValue:shape forKey:@"polygon"];


    1. iOS 7 Development Recipes


      View Book

    2. Swift Game Programming for Absolute Beginners


      View Book

    3. iPhone and iPad Apps for Absolute Beginners


      View Book

    4. Learn iOS 8 App Development


      View Book