Introduction to Property List Programming Topics for Core Foundation
Many applications require a mechanism for storing information that will be needed at a later time. For situations where you need to store small amounts of persistent data, less than a few hundred kilobytes, Core Foundation provides property lists. Property lists—frequently referred to as “plists”—offer a uniform and architecture-independent means of organizing, storing, and accessing data for Mac apps.
Organization of This Document
Property lists organize data into named values and lists of values using several Core Foundation types: CFString, CFNumber, CFBoolean, CFDate, CFData, CFArray, and CFDictionary. These types give you the means to produce data that is meaningfully structured, transportable, storable, and accessible, but still as efficient as possible. The property list programming interface allows you to convert hierarchically structured combinations of these basic types to and from standard XML. The XML data can be saved to disk and later used to reconstruct the original Core Foundation objects. Note that property lists should be used for data that consists primarily of strings and numbers because they are very inefficient when used with large blocks of binary data.
Property lists are used frequently in OS X. For example, the OS X Finder—through bundles—uses property lists to store file and directory attributes. Core Foundation bundles and URL objects use property lists as well. User and application preferences also use property lists, however, you should not use the CFPropertyList API to read and modify preferences. Core Foundation provides a programming interface specifically for this purpose—see Preferences Programming Topics for Core Foundation for more information.
This document describes the property list structure, and use of XML tags and specifics about numbers, and contains examples on creating, saving, and restoring property lists.