Pro Core Data for iOS

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Michael Privat , Robert Warner
Edition: 1
Publisher: Apress
Year: 2011

Language: English
Pages: 394

How to Contact Us......Page 0
What Is Core Data?......Page 19
History of Persistence in iOS......Page 20
Understanding the Core Data Components......Page 21
Creating a New Project......Page 23
Running Your New Project......Page 24
Understanding the Application’s Components......Page 25
Fetching Results......Page 27
Inserting New Objects......Page 29
Initializing the Managed Context......Page 31
Adding the Core Data Framework......Page 33
Creating the Data Model......Page 34
Initializing the Managed Object Context......Page 39
Core Data Framework Classes......Page 45
The Model Definition Classes......Page 48
The Data Access Classes......Page 56
Key-Value Observing......Page 60
The Query Classes......Page 61
How the Classes Interact......Page 64
SQLite Primer......Page 69
Reading the Data Using Core Data......Page 71
Summary......Page 73
Using SQLite as the Persistent Store......Page 75
Configuring the One-to-Many Relationship......Page 79
Building the User Interface......Page 81
Creating a Team......Page 84
The Player User Interface......Page 94
Adding, Editing, and Deleting Players......Page 97
Seeing the Data in the Persistent Store......Page 103
Using an In-Memory Persistent Store......Page 106
Creating Your Own Custom Persistent Store......Page 108
Initializing the Custom Store......Page 110
Mapping Between NSManagedObject and NSAtomicStoreCacheNode......Page 113
Serializing the Data......Page 115
Using the Custom Store......Page 119
What About XML Persistent Stores?......Page 121
Summary......Page 124
Designing Your Database......Page 125
Relational Database Normalization......Page 126
Using the Xcode Data Modeler......Page 127
Viewing and Editing Attribute Details......Page 132
Viewing and Editing Relationship Details......Page 133
Using Fetched Properties......Page 134
Creating Entities......Page 136
Creating Attributes......Page 138
Creating Relationships......Page 140
Name......Page 141
Destination and Inverse......Page 142
Delete Rule......Page 143
Summary......Page 144
Understanding CRUD......Page 147
Creating the Shape Application Data Model......Page 150
Building the Shape Application User Interface......Page 156
Enabling User Interactions with the Shapes Application......Page 167
Generating Classes......Page 169
Modifying Generated Classes......Page 178
Using the Transformable Type......Page 183
Validating Data......Page 186
Custom Validation......Page 188
Default Values......Page 192
Undoing and Redoing......Page 193
Disabling Undo Tracking......Page 194
Adding Undo to Shapes......Page 195
Summary......Page 198
Building the Test Application......Page 199
Creating the Org Chart Data......Page 201
Reading and Outputting the Data......Page 204
Filtering......Page 205
Expressions for a Single Value......Page 206
Comparison Predicates......Page 207
Compound Predicates......Page 210
Subqueries......Page 212
Aggregating......Page 215
Returning Unsorted Data......Page 217
Sorting Data on One Criterion......Page 218
Sorting on Multiple Criteria......Page 219
Summary......Page 220
Building the Application for Testing......Page 221
Creating the Core Data Project......Page 222
Creating the Data Model and Data......Page 224
Creating the Testing View......Page 226
Building the Testing Framework......Page 229
Adding the Testing Framework to the Application......Page 231
Running Your First Test......Page 233
Firing Faults......Page 236
Refaulting......Page 237
Building the Faulting Test......Page 238
Taking Control: Firing Faults on Purpose......Page 242
Prefetching......Page 243
Caching......Page 246
Expiring......Page 249
Expiring the Cache Through Faulting......Page 250
Uniquing......Page 251
Improve Performance with Better Predicates......Page 255
Using Faster Comparators......Page 256
Using Subqueries......Page 257
Analyzing Performance......Page 260
Launching Instruments......Page 261
Understanding the Results......Page 264
Summary......Page 266
Versioning and Migrating Data......Page 269
Versioning......Page 270
Lightweight Migrations......Page 273
Migrating a Simple Change......Page 274
Renaming Entities and Properties......Page 276
Understanding Entity Mappings......Page 279
Understanding Property Mappings......Page 281
Creating a New Model Version That Requires a Mapping Model......Page 282
Creating a Mapping Model......Page 286
Migrating Data......Page 293
Running Your Migration......Page 294
Making Sure Migration Is Needed......Page 297
Running the Migration......Page 298
Summary......Page 299
Creating an Application for Note and Password Storage and Encryption......Page 301
Setting Up the Data Model......Page 302
Setting Up the Tab Bar Controller......Page 305
Adding the Tab......Page 309
Managing Table Views Using NSFetchedResultsController......Page 315
Understanding NSFetchedResultsController......Page 316
Understanding NSFetchedResultsController Delegates......Page 317
Incorporating NSFetchedResultsController into MyStash......Page 318
Creating the Interface for Adding and Editing Notes and Passwords......Page 326
Splitting Data Across Multiple Persistent Stores......Page 341
Using Model Configurations......Page 342
Persistent Store Encryption Using Data Protection......Page 347
Data Encryption......Page 350
Registering an Observer......Page 357
Receiving the Notifications......Page 358
Adding Categories to Passwords......Page 360
Creating a New Version of Seeded Data......Page 363
Handling Core Data Operational Errors......Page 364
Handling Validation Errors......Page 367
Handling Validation Errors in MyStash......Page 370
Summary......Page 376
Index......Page 377