STORING AND USING DOCUMENTS IN ICLOUD

From an iOS developer's perspective, iCloud presents two different usage scenarios:

  • Document storage — Saves all your application documents on iCloud so that it accessible to other devices
  • Key-value data storage — Saves small amounts of application-specific data to the application so that it can be shared with other devices

The first usage involves saving documents in your application on the iCloud. For example, in an eBook reader application, a user may purchase an eBook (or simply copy a PDF document into the application's Documents folder; see Chapter 10). The user would expect the newly purchased eBook to be available to the same application on another device. Instead of storing the eBook on your application's sandbox, your application can make use of iCloud's document storage to store the eBook. Documents stored in the iCloud's document storage are automatically available to your application on all other devices. This way, all your application's documents are stored in a central location and available to all the user's devices.

The second usage allows you to store application-specific data on iCloud. Data that is specific to an application (such as application preferences) can be saved onto iCloud and made visible to the same application on all your other devices. Using the eBook reader example, the page number of a book that the reader is currently reading is a perfect example of an application-specific data that can be stored on the ...

Get Beginning iOS 5 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.