Expanded Limits for iCloud Storage

Apple recently announced that the limits on iCloud key value storage have been increased to 1MB from 64KB. These limits are per application and per individual value, with a limit of 1024 individual values.

Key value storage is one of two methods that developers can use to store iOS data in iCloud, the other being document storage. Key value storage uses a dictionary (also known as a map) of simple data values accessed via keys. Document storage allows you to work with discrete documents containing any content you choose to support.

Of the two methods, key value storage is the simpler to use, requiring only a few lines of code to push data into the cloud and a simple handler to respond to changes coming down from other devices. Document storage is more complex, with the usual approach being to wrap documents (whatever that means for your application) in an iCloud-aware document wrapper, store in the iCloud synchronized parts of the device filesystem, and manually handle conflicts between local and cloud versions.

While document storage is limited only by the iCloud plan associated with the device, key value storage has always been size-limited per application and per key, ostensibly to encourage its use for preferences and status values. A good example of a typical application of the key value store is the current page in iBooks: read a few pages of a book on your iPhone and when you open the book on your iPad, you can pick up exactly where you left off. Applications like the standard iOS Notes application would most likely use document storage to share their data as documents.

The expansion of the key value storage limit to 1MB means that simple applications with modest data requirements have more scope to use the key value store for sharing application data as well as simple preferences. For purely textual information, 64KB isn’t too bad but 1MB is quite significant. This looks to me like an acknowledgement from Apple that key value storage is a viable option for application data as well as preferences. The documentation still suggests using document storage for documents, but it’s a suggestion rather than a directive. That’s good news for developers because the iCloud key value store is so simple to use.

You can learn more about iCloud storage techniques, including specific examples of storing data in iCloud with the key value store, on Learning Tree’s Building iPhone® and iPad® Applications: Extended Features course.

Richard Senior

Type to search blog.learningtree.com

Do you mean "" ?

Sorry, no results were found for your query.

Please check your spelling and try your search again.