Introduction
Overview
Most Mac apps need to manage data. Data management involves the creation and handling of the various types of data available to a program, including strings, rich text, binary data, dates, collections, property lists, and XML data. Mac apps use data management interfaces to store and access data in local databases, files, folders, and bundles. They also use data management interfaces to receive and respond appropriately to events and other types of messages, such as notifications.
OS X data management interfaces reside in several different frameworks. The principal frameworks are:
Foundation—An Objective-C framework that defines a base layer of classes that can be used for any type of OS X program. Foundation classes provide object wrappers or equivalents for primitives such as numeric values, strings, and collections. Foundation also includes utility classes for accessing underlying system entities and services, such as ports, threads, and file systems. The Foundation API is documented in Foundation Framework Reference.
Application Kit—An Objective-C framework that provides the key infrastructure for implementing graphical, event-driven applications in OS X. Application Kit includes such classes as
NSResponder
,NSApplication
, andNSEvent
to manage user interface data. The Application Kit API is documented in Application Kit Framework Reference.Core Data—A generalized framework for object graph management and persistence. Core Data includes support for features such as undo and redo, change propagation—including maintaining the consistency of relationships among objects, and storing objects in external data repositories. The Core Data API is documented in Core Data Framework Reference.
Address Book—The Address Book framework allows you to retrieve information from and add your own properties to the people and groups in the contacts database. The Address Book API is documented in Address Book Objective-C Framework Reference.
Core Foundation—A set of programming interfaces conceptually derived from the Foundation framework but implemented in the C language. Core Foundation defines opaque types for data objects such as strings, collections, time and dates, ports, application run loops, interprocess communication, and preferences. The Core Foundation API is documented in Core Foundation Framework Reference.
Data Management
The following sections describe different areas of data management and the documentation you should read to learn more about them.
Basic Values
Cocoa provides object abstractions for the basic data types you’re likely to use in almost any program, such as strings, dates, numbers, and even binary data. It also provides collection classes and other abstractions to group values together. To learn about these data types, read:
Storing Application Data
Cocoa provides several ways to save your application’s data. The technology you choose depends on how much data you want to save, and what sort of data it is.
To learn how to use property lists to save simple collections and basic values, read Property List Programming Guide.
To learn how to create archives of object graphs, read Archives and Serializations Programming Guide.
To learn how you can use Core Data for persistence, as well as sophisticated object graph management, read Core Data Overview.
To learn how to manage application preferences—also known as user defaults—read Preferences and Settings Programming Guide .
Handling Events
In addition to input from mouse and keyboard, OS X OS supports input from tablets and, on a portable Macintosh, multi-touch using a trackpad.
Read Event Handlingh in Mac App Programming Guide, then Cocoa Event Handling Guide.
Accessing Contact Information
Address Book is a centralized database for contacts and other personal information. Contact information is important for software such as email and chat programs.
Read Address Book Programming Guide for Mac to learn how to leverage the contacts database in your application. You can not only access a user’s contact data but also design and implement your own properties and actions for the data.
Locating Application Data
OS X provides a number of standard directories where application data might reside. Cocoa provides classes and methods to help you to locate these directories on the filesystem and as resources within your application.
Read Locating Directories on the System in Low-Level File Management Programming Topics to learn about standard directories.
Read Bundle Programming Guide to learn how applications and file packages are stored on disk and how you can access them.
Copyright © 2011 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2011-01-27