Core Data Release Notes for OS X v10.6 and iOS 4

This article summarizes some of the new features and changes in functionality in Core Data in OS X v10.6 and iOS 4.

Contents:

Lightweight Migration

The store migration feature has been improved to automatically handle certain deterministic scenarios.

If you just make simple changes to your model (such as adding a new attribute to an entity), Core Data can perform automatic data migration, referred to as lightweight migration. Lightweight migration is fundamentally the same as ordinary migration, except that instead of you providing a mapping model, Core Data infers one from differences between the source and destination managed object models.

Lightweight migration is especially convenient during early stages of application development, when you may be changing your managed object model frequently, but you don’t want to have to keep regenerating test data. You can migrate existing data without having to create a custom mapping model for every model version used to create a store that would need to be migrated.

A further advantage of using lightweight migration—beyond the fact that you don’t need to create the mapping model yourself—is that if you use an inferred model and you use the SQLite store, then Core Data can perform the migration in situ (solely by issuing SQL statements). This can represent a significant performance benefit as Core Data doesn’t have to load any of your data. Because of this, you are encouraged to use inferred migration where possible, even if the mapping model you might create yourself would be trivial.

To lean more, consult Lightweight Migration in Core Data Model Versioning and Data Migration Programming Guide.

Improved Fetch Performance

A number of new options have been added to NSFetchRequest to allow finer control of fetch performance.

To learn more, see NSFetchRequest Class Reference.

Expanded Predicate Support

Predicates now support:

To learn more, see NSExpression.h.

Spotlight Integration in OS X

Support for integration with Spotlight has been expanded for non-Document based applications in OS X.

Core Data helps you to manage a graph of objects in your program and to save the graph to a persistent store file. Spotlight is a fast desktop search technology that allows users to organize and search for files based on metadata. To integrate a Core Data-based program with Spotlight, you have to provide the Spotlight indexer with information about the data in your persistent store. Document-based Core Data applications should continue to use the mechanisms introduced in Mac OS 10.5, mainly, associating spotlight indexing information with the store file.

For non-Document based applications, you now have the option of mirroring Core Data records into external files, to be indexed independently by Spotlight. You still need to write a Spotlight importer, but you'll now be indexing the individual record files. An expanded Xcode Application Template (non-Document based Core Data Application) gets you started.

To lean more, consult the new Core Data Spotlight Integration Programming Guide.

Other New API

The following classes also provide new API—see the API reference documentation for more details.