Chapter 10. Data Storage

WHAT'S IN THIS CHAPTER?

  • How to save user-entered information locally in a Property List

  • How to use the Core Data framework

  • Working with the Xcode Data Modeling tool

Imagine you have just designed an application for which you have worked out all the details except one: How can you store information locally?

The data you want to store is not application preferences, which are handled by the settings bundle. The information you want to store is user-entered information. iOS 4 provides two very elegant ways for you to handle this: Property lists and Core Data.

In this chapter you will build an application that stores the first name, last name, and phone contact information in both of these formats. Building the same application in each format highlights the different data storage techniques you can offer in your own applications.

Which format is the right one to use? That depends on your application's needs. For small quantities of data, the XML property list may be the easiest to implement. For larger amounts of data, the Core Data solution may be appropriate.

Keep in mind that the target of your application is a mobile device; it was not designed to house a central warehouse database of enormous size. Apple has provided efficient methods that are more than adequate to handle your data storage needs. For larger storage needs Apple does provide MobileMe as one possible solution.

PROPERTY LISTS

Property lists, which use the extension .plist, are simple XML-formatted files ...

Get Professional iPhone® and iPad™ Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.