Tutorial Details
- Technology: iOS SDK
- Difficulty: Intermediate
- Completion Time: 1 Hour
Keeping application data synchronized across devices is a complex and daunting task. Fortunately, that is exactly why Apple built iCloud. In this Tuts+ Premium series, you will learn how iCloud works and how your applications can seamlessly share data across multiple devices.
Tutorial Teaser
In the first installment of this series, I gave an introduction to iCloud and focused on iCloud Storage in particular. Two types of iCloud Storage are avaialable to developers, Key-Value Storage and Document Storage. Key-Value Storage will be the focus of this tutorial.
We will start this tutorial by taking a closer look at the process of setting up an application for use with iCloud. With our application properly configured, we will make use of iCloud’s Key-Value Storage to keep our application’s data synchronized across multiple devices.
Before We Begin
We cannot test data synchronization with just one device. To complete this tutorial, you will need to have at least two iOS devices running iOS 5 or higher. Unfortunately, the iOS Simulator cannot be used to test iCloud Storage.
The application we are about to build will be a simple iOS application, which means that you will be able to run it on any iPhone, iPod Touch, or iPad running iOS 5 or higher. Reading this tutorial will still be worthwhile even if you don’t have two separate iOS devices to use for testing. It will teach you how iCloud is set up and how you can use iCloud’s Key-Value Storage to enhance your own applications.
Step 1: Project Setup
I will start by walking you through the process of configuring our application to use iCloud Storage. However, we first need to set up our Xcode project.
Create a new project in Xcode by selecting the Single View Application template. Name your application Cloudy, enter a company identifier, set iPhone for the device family, and check Use Automatic Reference Counting. The remaining checkboxes should be unchecked. Tell Xcode where you want to save your project and hit Create.


It is key that you carefully choose the product name and company identifier for this project. The combination of these two elements form the bundle identifier (together with the bundle seed identifier) of your application, which iCloud will use to uniquely identify your application. Carefully check your spelling, because the bundle identifier is case sensitive.
Step 2: Setting Up iCloud
As I mentioned in the first article of this Tuts+ Premium series, setting up an application to use iCloud is easy and involves only two steps. Let me walk you through the process step-by-step.
Step 2A: Provisioning Portal
Open your favorite browser and head over to Apple’s iOS Dev Center. Log in to your iOS developer account and click the iOS Provisioning Portal link on the right.

First, we need to create an App ID for our application. Open the App IDs tab on the left and click the New App ID button at the top right. Give your App ID a descriptive name to easily identify it later. Next, enter the bundle identifier I talked about a few moment ago. The bundle identifer is the combination of your company identifier, com.mobiletuts in our example, and the product name, Cloudy in our example. You can leave the bundle seed identifier set to Use Team ID, which is fine for our application.
Double-check that your bundle identifier is spelled correctly. As I mentioned earlier, the bunder identifier is case sensitive. Click the submit button to create your App ID.

Your newly created App ID should now be present in the list of App IDs. You will notice that iCloud is disabled by default for every newly created App ID. Let’s change that. On the right of your App ID, click the Configure button. At the bottom of the page, you should see a checkbox that says Enable for iCloud. Check the checkbox and click Done. Our App ID is now configured to work with iCloud. There is one more thing we need to take care of while we are in the Provisioning Portal.


To ensure that our application can run on our devices, we need to create a provisioning profile. Still in the iOS Provisioning Portal, open the Provisioning tab on the left and select the Development tab at the top. Click the New Profile button at the top right and enter a descriptive name for your new profile. Next, select the development certificate you want the profile to be associated with and choose the correct App ID from the drop-down list. Finally, select the devices you will use for testing from the list at the very bottom of the page.

After clicking the submit button in the bottom right, you will notice that your provisioning profile has a status of Pending. After reloading the page, the profile’s status should have updated to Active. Click the download button next to your provisioning profile and double-click the profile. Xcode will automatically install the profile for you.


Get the Full Series!
This tutorial series is available to Tuts+ Premium members only. Read a preview of this tutorial on the Tuts+ Premium web site or login to Tuts+ Premium to access the full content.
Joining Tuts+ Premium. . .
For those unfamiliar, the family of Tuts+ sites runs a premium membership service called Tuts+ Premium. For $19 per month, you gain access to exclusive premium tutorials, screencasts, and freebies from Mobiletuts+, Nettuts+, Aetuts+, Audiotuts+, Vectortuts+, and CgTuts+. You’ll learn from some of the best minds in the business. Become a premium member to access this tutorial, as well as hundreds of other advanced tutorials and screencasts.
- http://premiumgfx.com/ Premium Graphics
