You are previewing Pro Core Data for iOS: Data Access and Persistence Engine for iPhone, iPad, and iPod touch, Second Edition.
O'Reilly logo
Pro Core Data for iOS: Data Access and Persistence Engine for iPhone, iPad, and iPod touch, Second Edition

Book Description

Fully updated for Xcode 4.2, Pro Core Data for iOS explains how to use the Core Data framework for iOS SDK 5 using Xcode 4.2. The book explains both how and why to use Core Data, from simple to advanced techniques. Covering common and advanced persistence patterns, this book prepares any iOS developer to store and retrieve data accurately and efficiently.

This book starts by giving you a solid grounding in Core Data, providing a foundation for the rest of the book. With this knowledge, you'll have all you need to master Core Data and power your data-driven applications. You'll see how to work with SQLite and how to create an efficient data model to represent your data. Once you've established your data model, you'll learn how to work with data objects and refine result sets to get the most out of the stored data.

The advanced portions of the book begin by showing you how to tune your apps' performance and memory usage, to give you a truly professional edge. You'll see how to version and migrate your data as well, to ensure your data stays organized and efficient. Finally, the book covers managing table views with NSFetchedResultsController.

What you'll learn

  • Core Data techniques with Xcode

  • How to organize data appropriately

  • How to persist data efficiently

  • How to effectively use Apple tools

  • How to build Core Data applications

  • How to use Core Data in advanced settings

  • How to version and migrate data as your applications evolve

  • How to tune and optimize persistence

Who this book is for

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

Table of Contents

  1. Title
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Authors
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Introduction
    1. Why a Second Edition?
    2. What You'll Need
    3. What You'll Find
    4. How This Book Is Organized
    5. Source Code and Errata
    6. How to Contact Us
  9. Chapter 1: Getting Started
    1. What Is Core Data?
    2. History of Persistence in iOS
    3. Creating a Basic Core Data Application
    4. Adding Core Data to an Existing Project
    5. Summary
  10. Chapter 2: Understanding Core Data
    1. Core Data Framework Classes
    2. How the Classes Interact
    3. Summary
  11. Chapter 3: Storing Data: SQLite and Other Options
    1. Visualizing the User Interface
    2. Using SQLite as the Persistent Store
    3. Using an In-Memory Persistent Store
    4. Creating Your Own Custom Persistent Store
    5. Summary
  12. Chapter 4: Creating a Data Model
    1. Designing Your Database
    2. Using the Xcode Data Modeler
    3. Creating Entities
    4. Creating Attributes
    5. Creating Relationships
    6. Summary
  13. Chapter 5: Working with Data Objects
    1. Understanding CRUD
    2. Generating Classes
    3. Modifying Generated Classes
    4. Using the Transformable Type
    5. Validating Data
    6. Undoing and Redoing
    7. Summary
  14. Chapter 6: Refining Result Sets
    1. Building the Test Application
    2. Filtering
    3. Aggregating
    4. Sorting
    5. Summary
  15. Chapter 7: Tuning Performance and Memory Usage
    1. Building the Application for Testing
    2. Faulting
    3. Caching
    4. Expiring
    5. Uniquing
    6. Improve Performance with Better Predicates
    7. Analyzing Performance
    8. Summary
  16. Chapter 8: Versioning and Migrating Data
    1. Versioning
    2. Lightweight Migrations
    3. Creating a Mapping Model
    4. Migrating Data
    5. Custom Migrations
    6. Summary
  17. Chapter 9: Managing Table Views Using a Fetched Results Controller
    1. Understanding NSFetchedResultsController
    2. Understanding NSFetchedResultsController Delegates
    3. Using NSFetchedResultsController
    4. Implementing NSFetchedResultsController in League Manager
    5. Implementing the NSFetchedResultsController
    6. Implementing the NSFetchedResultsControllerDelegate Protocol
    7. Summary
  18. Chapter 10: Using Core Data in Advanced Applications
    1. Creating an Application for Note and Password Storage and Encryption
    2. Splitting Data Across Multiple Persistent Stores
    3. Adding Encryption
    4. Sending Notifications When Data Changes
    5. Seeding Data
    6. Error Handling
    7. Summary
  19. Index