Cloud Zone is brought to you in partnership with:

I am the API Evangelist. Not in the sense that I’m evangelizing a single API to you--In the sense that APIs are important for everyone to be aware of. I’m paying attention to not just the technical, but the business and politics of the web API movement. I share my insights by blogging on the business of APIs at apievangelist.com, politics of APIs at apivoice.com and you can find more information about me at kinlane.com. Kin is a DZone MVB and is not an employee of DZone and has posted 72 posts at DZone. You can read more from them at their website. View Full User Profile

Key-Value Data Store in iCloud

06.17.2011
| 2520 views |
  • submit to reddit
Apple’s new iCloud platform includes a new key-value data store, along side its document storage.

An application can use the key-value data store to put small amounts of data in the cloud, and share with other instances of the same application running on other computers and IOS devices.

The key-value data store is meant to save simple data types (numbers, strings, dates, and arrays) persistently and retrieve  later.

The amount of available space in a single key-value store is limited to 64 KB and the data for a single key cannot exceed 4 KB. This size allows the storage of small details from an application, but should not be used to store user documents or other large data objects, this should be done with iCloud document storage.

Before an application can have access to a users key-value data stores it must request specific entitlements, in order to use iCloud storage. This ensures a user has control over what gets stored in their iCloud account.

The container identifier string must be of the form <TEAM_ID>.<CUSTOM_STRING>, where <TEAM_ID> is the unique ten-character identifier associated with an application developer account. The contents of <CUSTOM_STRING> can be anything that makes sense to your application. You can even use the same container identifier string for multiple applications if you want them to share the same storage space.

The value of the container identifiers key is an array of strings. The first string in this array must be the main container identifier to associate with the application. Companies that develop multiple applications, can include additional container identifiers.

Some examples of key-value usage might be, storing the current page or section of an application, so when the user returns to the applicaiton on same device or other devices, it opens to that same page and section.

iCloud key-value storage is meant to empower developers with a centralize storage to use between devices, that enhances the user experience on Mac and iOS devices.

References
Published at DZone with permission of Kin Lane, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)