ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming»
  • Computer Programming Tutorials

IOS 5 | How-To Create and Configure an iCloud IOS 5 app

Updated on January 10, 2012

iCloud is one the new features of IOS 5 with a lot of promise and real user payback with the growing number of devices we are all using. iCloud allows a user to share and sync their data from various apps between devices. Basically data is uploaded to servers on the Internet and vice versa downloaded updated locally when a device is connected. Apps can also share data amongst themselves, something that was a bit tricky beforehand.

This tutorial will walk you through the process of setting up iCloud to be used in a document based app and to share a simple document.

Authors Note: You need an IOS Developer Program to do this tutorial. They can be purchased from the Apple Developer web site.

Step 1 : Create a Provisioning Profile


Each app that you deploy to a device or the App Store requires a Provisioning Profile, regardless if you want to use iCloud or not. We also need a Provisioning Profile because you can’t test iCloud on the XCode Simulators, you need to deploy to a device: iPad, iPhone or iPod Touch. You also need a Provisioning Profile to enable iCloud.

Navigate to the Apple Developer Portal and click on Member Center. Click on the IOS Provisioning Portal link and click on the App ID tab to setup your app.

Access Member Center
Access Member Center

Click on the New App ID button. Enter a name for your app following the instructions on the page. For this tutorial, I used quickDox as an app name. Also enter a Bundle identifier; something like com.kevlangdo.quickDox. Click on the Submit button to save the App ID.


Create IOS App ID
Create IOS App ID

At the bottom of the App ID Manage tab you see you app in a grid with thew Push Notifications and Game Center enabled as well as the InApp Purchases enable. To enable iCloud for your app, click on the Configure button under the Action heading.

In the Configure App ID page, enable the iCloud service and click on the Done button to save your changes. That is it for enabling iCloud in the Provisioning Portal.

Configure iCloud in the Push Notifications.
Configure iCloud in the Push Notifications.
Enable iCloud in the IOS Provisioning Page
Enable iCloud in the IOS Provisioning Page

Next we need a Provisioning Profile proper. The first part of this step was to create an App ID and enable iCloud for that app. Click on the Provisioning tab. Click on the New Profile button, enter a name for the Provisioning Profile like quickDox iCloud Test App; Select a certificate, select the App ID that you set up in the first part of this Step and finally select a device or devices that you will use to test your app. If no device is available, you will need to set one up.

Create a new Provisioning Profile
Create a new Provisioning Profile
Fill in the Provisioning Profile Page
Fill in the Provisioning Profile Page

Click the Submit button to save you changes.

Back at the Provisioning Profiles page, under Actions for your new app, a download button will appear after a few minutes. You may need to refresh your page a few times. Download the Provisioning Profile when ready. Double click on the file to add the Provisioning Profile to your XCode Organizer.

Add Provisioning Profile to XCode Organizer
Add Provisioning Profile to XCode Organizer

Step 2 : Create iCloud Enabled App


Once the Provisioning Profile is created and configure in XCode, it is time to create our app and enable iCloud.

Select the Page View Application
Select the Page View Application
Create the Page Based Project
Create the Page Based Project
Universal App Storyboards
Universal App Storyboards

Launch XCode and create a Page-Based application. Give your app the same name as the App ID you created in the IOS Provisioning Portal. Enter the same company identifier as in the IOS Provisioning Portal, add the optional prefix and select Universal for the Device Family. Click Next to create the project.

You will notice that XCode created two storyboards; one for each device type.

Select Project root to open the Targets page. Scroll to the bottom of the page to the Entitlements section. Enable the Entitlements by checking the appropriate checkbox. You will notice that the iCloud key/value pair gets filled in as well as iCloud containers and Access Key fields. You will also notice that a new file with the entitlements extension is created and placed in the project files path.

Enable Entitlements
Enable Entitlements

If you select the file, it will display the Entitlement configuration for your app.

Step 3 : Check for iCloud Availability

To be able to bow out gracefully when the device is not connected or otherwise unavailable, we will add some code to the AppDelegate implementation file in the didFinishLaunchingWithOptions method. So, click on the AppDelegate file, in my project it is kvlAppDelegate.m and add the following code to the didFinishLaunchingWithOptions method:

iCloud Availability Code
iCloud Availability Code

The URLForUbiquityContainerIdentifier method returns the container associated with the current app. If the iCloud service isn’t available, the application will catch the error and bow out gracefully. Specifying nil as a parameter returns the first container that is configured in the Entitlements file. You could specify a hard coded value here as well as a string for the Container ID.

Step 4: Test the iCloud service

Connect your device to your Mac and when XCode detects its presence, it will appear in the Scheme selector field.

Deploy to actual device
Deploy to actual device

Select the target device and launch the app. It will get deployed to the target device and launch. Open the log console and you will see the following message that iCloud service has accessed the local file system. The daemon transfers file to this directory on your target device. You can retrieve and or place files at this location for syncing.

Console Output
Console Output

In Summary

This is the steps in a nutshell to create the basic iCloud application. In the next tutorial I will show how to actually create documents or files and to sync them with the external iCloud service.

Comments

    0 of 8192 characters used
    Post Comment

    • klanguedoc profile image
      Author

      Kevin Languedoc 3 years ago from Canada

      No I don't believe so. It is more about asset management and organization.

    • profile image

      Ramanan R R 3 years ago

      "Give your app the same name as the App ID you created in the IOS Provisioning Portal." Product name needs to same or different ? Is that an issue if it differs Product name and App ID suffix ?

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: "https://hubpages.com/privacy-policy#gdpr"

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)