This tutorial takes you through the steps of building a very basic Core Data–based command-line utility. The goal is to illustrate the creation of a Core Data application entirely in code. It shows that although Cocoa bindings can be used to leverage the functionality in Core Data, it is possible to use Core Data independently. Moreover, it shows all aspects of the creation of a Core Data stack, instantiation of managed objects, and fetching, all without the distraction of a user interface. It even shows the creation of a model in code.
The task goal of this tutorial is to create a low-level Core Data–based utility. It simply records the date on which the utility is run, records its process ID, and prints the run history to the output. The utility uses a single entity, Run. The Run entity is very simple; it has only two attributes, the process ID and the date on which the process was run.
Note that the emphasis in this tutorial is on illustrating low-level functionality in Core Data, not on compactness, maintainability, or user friendliness. Although some explanation is given of what happens behind the scenes, it does not give an in-depth analysis of the Core Data infrastructure.
Last updated: 2008-02-08