iCloud 1: An introduction to iCloud

Before talking about how to use iCloud, it helps to understand what it is.  Let’s start with a description from Apple’s iCloud web site:

“iCloud stores your music, photos, documents, and more and wirelessly pushes them to all your devices. Automatic, effortless, and seamless — it just works.”

To make it simpler: iCloud is synchronization.  It syncs your data between your iPhone and the cloud.  It syncs your data between your iPhone and your Mac (there is also some limited support for Windows). It is incorporated into iOS and OS X Lion in such a way that, when combined with other enhancements (such as document versioning) you can get access to the latest, most up-to-date version of your data.  The image below illustrates this flow.


iCloud Synchronization (Source: Apple.com)

Note that in the above description I emphasized the word “your”.  As it is currently implemented, it is only data that you create or consume on your devices. Data access and storage is based on your Apple ID.  There is no mechanism for associating multiple Apple ID’s with your data.

Before iCloud, applications normally accessed data objects (files/documents/databases) that were stored locally on the device.  Sharing data between devices was typically done through an explicit user action, such as copy the file to and from a file server or web site.

What iCloud does is provide a series of interfaces that developers can use to integrate synchronizing this data with Apple’s iCloud servers.  The synchronization is a part of the operating system (OS) that developers can access using these application programming interfaces (API’s).  Some of the features of these interfaces include:

  • File upload/download;
  • Data streaming (for database objects);
  • Conflict resolution (there are changes in both the document on the server and the document locally that need to be reconciled).

Apple has done a really good job at integrating iCloud in such a way as to minimize the amount of change you need to make to your code, but there are some challenges that developers need to keep in mind.  For example, opening a document that is stored locally on the file system is fairly simple – you can easily search the file system for the file, and opening it is so fast that you can typically wait for the file to open.  With iCloud, you now have to deal with network latency issues.  Opening a file now might entail downloading the document from the iCloud servers.  You now are at the mercy of the speed of the network and the size of the document.

iCloud versus Dropbox

A lot of developers are incorporating services like Dropbox into their applications to enable synchronization and sharing of information (there are other services, such as Box.net, that some use as well, but Dropbox seems to be the most popular as of this writing, so that is where I will focus).

Dropbox provides file-level syncing between devices and the Dropbox cloud. Applications can take advantage of the API that Dropbox provides for uploading/downloading files.  There is no intelligent cache management – it just downloads the files to the device and stores it if there is enough room.  On some systems Dropbox also hooks into the operating system to provide an intelligent folder that mirrors the layout of data in the Dropbox cloud.

Another advantage of Dropbox – it supports multiple operating systems (OS X, iOS, Windows, Linux) and provides API’s for several different languages (Objective-C, Ruby, Python).  There are also some third-party API’s that provide support for C#/.Net and Node.js (among others).

Finally, Dropbox supports sharing files and folders between users.  This is done using the Dropbox login ID.  There are no limits to the number of users with whom you can share data.

The cost of Dropbox is that you need to learn another API, and the amount of storage that you get for free is 2 GB.  iCloud gives you 5 GB of storage, over and above any purchases you make in iTunes (any music/apps/books that you buy via iTunes do not count against your 5 GB storage limit).  Both services allow you to purchase additional storage for a fee.

Any data shared between Dropbox users counts against the quota of each Dropbox users.  For example, if user A shares a folder with users B and C, and C puts 2 GB of data in that folder, then both A and B are at their 2 GB limit, even if they haven’t put a single byte of data into their Dropbox storage.

Which to use?  It all depends.  If you have an existing appellation that stores data in local storage and want to take advantage of cloud backup and synchronization, then iCloud is the simplest way to get this.  If you need to share data with multiple users, then you should use Dropbox (or one of its competitors).

Next: Enabling an XCode application to use iCloud

Announcing an iCloud Tutorial

I’m going to be speaking at CocoaHeads NY next month (December 5th) (as one of a couple of speakers).  I’m planning on doing an introduction to iCloud for developers.  What I’d like to do is work on pieces of this presentation here so that I could get some feedback during this.

I am currently in the finishing up stage of an application that I am building – a storyboarding application for the iPad (StoryBuild).  I am incorporating iCloud into this app partly as a learning experience and partly as a mechanism to sync the storyboards between different iPads (eventually I plan to port this application to other devices, but the iPad was my inspiration for this app).  Some of the topics I plan on covering in this tutorial are (in no particular order):

  • How to set up an application to use iCloud
  • Using NSFileManager and friends with iCloud
  • UIDocument and iCloud
  • Core Data and iCloud
  • Gotchas and failing gracefully

I only have a 30 minute presentation slot, and this is an ambitious list.  While I plan on referencing code I’m using in StoryBuild, I plan on having a separate project that will be available to download for you to try.  As to the format, I’m planning on following the same format I used in my Introduction to Cocos2D presentation from 360|iDev Austin in November, 2010.

Re: A Letter to the Developer Community

(Reference: http://wildchocolate.tumblr.com/post/12555879965/a-letter-to-the-developer-community)

Please read the above first before reading the following:


That this kind of stuff happens at conferences is both not surprising and totally unacceptable.  We live in an age where we should be above this kind of crap.  Unfortunately, between the above and postings like this from a Rails conference a couple of years ago I guess we still have a long way to go.