About Incorporating iCloud into Your App
iCloud is a free service that lets users access their personal content on all their devices—wirelessly and automatically via Apple ID. iCloud does this by combining network-based storage with dedicated APIs, supported by full integration with the operating system. Apple provides server infrastructure, backup, and user accounts, so you can focus on building great iCloud-enabled apps.
There are three iCloud storage services: key-value storage, document storage, and CloudKit. The core idea behind key-value and document storage is to eliminate explicit synchronization between devices. A user never needs to think about syncing, and your app never interacts directly with iCloud servers. When you adopt these APIs as described in this document, changes appear automatically on all the devices attached to an iCloud account. Your users get safe, consistent, and transparent access to their personal content everywhere.
CloudKit allows you to store app and user data as records in a public database, that is shared between users of your app, or a private database accessible only by the current user. However, it’s your responsibility to determine when to fetch and save records. Because the data is shared, your app also needs to keep local records synchronized. For native apps, CloudKit provides the CloudKit framework, and for web apps, the CloudKit JS library and web services to access these databases.
To check the availability of iCloud services for your type of app, see Supported Capabilities in App Distribution Guide.
At a Glance
iCloud is all about content, so your integration effort focuses on the model layer of your app. Because instances of your app running on a user’s other devices can change the local app instance’s data model, you design your app to handle such changes. You might also need to modify the user interface for presenting iCloud-based files and data.
In one important case, Cocoa adopts iCloud for you: A document-based app for OS X v10.8 or later requires very little iCloud adoption work, thanks to the capabilities of the
There are many different ways you can use iCloud storage, and a variety of technologies available to access it. This document introduces all the iCloud storage APIs and offers guidance in how to design your app in the context of iCloud.
iCloud Supports User Workflows
Adopting iCloud key-value and document storage in your app lets your users begin a workflow on one device and finish it on another.
Say you provide a podcast app. A commuter subscribes to a podcast on his iPhone and listens to the first 20 minutes on his way to work. At the office, he launches your app on his iPad. The episode automatically downloads and the play head advances to the point he was listening to.
For a drawing app, an architect creates some sketches on her iPad while visiting a client. On returning to her studio, she launches your app on her iMac. All the new sketches are already there, waiting to be opened and worked on.
To store state information for the podcast app in iCloud, you’d use iCloud key-value storage. To store the architectural drawings in iCloud, you’d use iCloud document storage.
Many Kinds of iCloud Storage
There are four iCloud storage APIs to choose from. To pick the right one (or combination) for your app, make sure you understand the purpose and capabilities of each. The iCloud storage types are:
Key-value storage for discrete values, such as preferences, settings, and simple app state.
iCloud document storage for user-visible file-based information such as word-processing documents, drawings, and complex app state.
Core Data storage for shoebox-style apps and server-based, multidevice database solutions for structured content. iCloud Core Data storage is built on iCloud document storage and employs the same iCloud APIs.
CloudKit storage for managing structured data in iCloud yourself and for sharing data among all of your users.
This guide assumes you are already familiar with the software and tools you use to write code. If not, start by reading a number of platform-specific tutorials. Next, read the technology overview documents and then the specific iCloud technology documents.
To get started . . .
Start Developing iOS Apps Today
To learn about other technologies . . .
App Programming Guide for tvOS
Mac App Programming Guide
To learn about iCloud key-value storage
To learn about iCloud document storage
Document-Based App Programming Guide for Mac
To learn about Core Data. . .
To learn about CloudKit. . .