From the user’s perspective, iCloud is a simple feature that automatically makes their personal content available on all their devices. To make your app participate in this “magic,” you need to design and implement your app somewhat differently, and for this you need to learn about roles of your apps when they participate in iCloud.
These roles and the specifics of your iCloud adoption process depend on your app. You design how your app manages its data, so only you can decide which iCloud supporting technologies your app needs and which ones it does not.
This chapter gets you started with the fundamental elements of iCloud that all developers need to know.
First, Provision Your Development Devices
To start developing an iCloud app, you must have an appropriate device provisioning profile and bundle Id. If you still do not have these in place, learn about setting up a provisioning profile and bundle Id in “Provisioning Your App for Store Technologies” in App Distribution Guide.
iCloud Data Transfer Proceeds Automatically and Securely
When you adopt iCloud, the operating system initiates and manages uploading and downloading of data for the devices attached to an iCloud account. Your app does not directly communicate with iCloud servers and, in most cases, does not invoke upload or download of data. At a very high level the process works as follows:
You configure your app to gain access to special local file system locations known as ubiquity containers.
You design your app to respond appropriately to changes in the availability of iCloud (such as if a user signs out of iCloud) and to changes in the locations of files (because instances of your app on other devices can rename, move, duplicate or delete files).
Your app reads and writes to its ubiquity containers using APIs that provide file coordination as explained in “How iCloud Document Storage Works.”
An operating system automatically transfers data to and from iCloud as needed.
In iOS there is an exception to automatic iCloud data transfer. For the first time downloading of an iCloud-based document in iOS, your app actively requests the document. You learn about this process in “How iCloud Document Storage Works.”
iCloud secures user data with encryption in transit and on the iCloud servers and by using secure tokens for authentication. For details refer to iCloud security and privacy overview. Key-value storage employs the same security as iCloud uses for "Documents in the Cloud,” as it is described in that document.
Set Up Steps.
1) Enable iCloud for your Bundle id
2) Enable iCloud inside XCode project
3) Make sure iCloud Drive is enabled on device
Warning: You MUST specify a valid email address on account creation to verify with Apple. Otherwise, iCloud denies you access by having the ubiquity identity token always null. IAP though, for some reason, works just fine with an unverified address.