iOS devices have the capability to store data locally. The data is organized into a name/value relationship and uses the standard XML format. Apple recommends that the decision as to when to use property lists to persist data should be limited to small amounts, preferably less than a few hundred kilobytes. For larger amounts, Apple offers Core Data as an alternative solution.
Property lists are used quite frequently in standard Apple applications. For example, the application’s user settings are stored in a property list. The Settings app requires a specific format, but the structure is a property list.
To convert the XML element values in a property list into an Objective C object, Apple has defined the following relationships between the Objective C object and the property list’s XML element value, as shown in Table 22-1.
|Data Type||XML Tag||iOS Class|
|integer||< integer>||NSNumber (intValue)|
|floating point||<real>||NSNumber (floatValue)|
|Boolean||<true/> or <false/>||NSNumber (boolValue) YES or NO|
You can create property lists in two ways:
You can create a property list programmatically directly in Objective-C if all of the objects derive from the NSDictionary, NSArray, ...