Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



Run the iOS Sample

These instructions describe how to get the iOS sample app running with the Mobile Backend. These instructions assume that you have already deployed the backend .

Setup Xcode, Apple certificates and a provisioning profile

These steps will be familiar to an experienced iOS developer, and are explained in more detail in Apple's documentation .

  1. Download and install Xcode 4.6 on a Mac computer.
  2. Create an App ID in the Apple iOS Developer Center, with Push Notifications enabled as an app Service.
  3. Create an Apple Push Notification service SSL Certificate for your App ID .
    • This will enable the backend to send push notifications to your app.
  4. Create an iOS App Development certificate for your App ID .
    • This identifies your app to Apple.
  5. Create a Provisioning Profile for the App ID using the iOS App Development Certificate and a valid SSL.
  6. Install both the certificates and the provisioning profile by downloading them from the Apple Developer Centre and double-clicking on them in Finder.
  7. Export the Push Notification service SSL Certificate to a *.p12 file so you can upload it to the backend later:
    • Open KeyChain Access.
    • Browse My Certificates under category on the left.
    • Expand the push certificate .
    • Select both the push certificate and key.
    • Right click and choose to export 2 items.
    • Set a password on the certificate.

Create an iOS client ID

The client ID enables the app and the backend to identify each other.

  1. Open the Google API Console .
  2. Make sure your project is the currently active project. If it isn't, select it in the upper left project pulldown menu.
  3. Click API Access on the left hand menu.
  4. If this is the first client ID for this project, click Create an OAuth 2.0 client ID . If you have already created a client ID for this project, click Create another client ID .
  5. In the Create Client ID dialog, select Installed application the application type, and iOS for the installed application type.
  6. Enter the Bundle ID used to create your provisioning profile in the textbox labeled Bundle ID .
  7. Leave the App Store ID textbox blank.
    Bundle Id in Xcode

  8. Click Create client ID.
    Client ID Created

We will use the client ID in the next sections

Configure the backend to send Apple push notifications

  1. Navigate to the Mobile Backend configuration page https://your-project-id.appspot.com/admin/configure.jsp , replacing your-project-id with the Project ID you created when you deployed the backend.
  2. Select Secured by Client IDs under Authentication/Authorization.
  3. Enter the client ID created in the previous section into the iOS Client ID textbox.
  4. Enable Google Cloud Messaging and iOS Push Notification .
  5. Click Select APNS Certificate and Save to upload the .p12 certificate.
  6. Type the password you provided to export the Push Notification service SSL Certificate to a .p12 file.

  7. Click Save .

Enable billing in App Engine

To enable billing for your project:

  1. Visit the App Engine Console .
  2. Click Billing Status on the sidebar.
  3. Click Enable Billing .
  4. Follow the billing instructions, including entering credit card details.
  5. Click on Backends on the sidebar.
  6. Click Start for the worker backend instance.

Configure the iOS client app to run with the deployed backend

  1. Download the iOS client zip file (or clone from GitHub repository ) and unzip to a location of your choice.
  2. Use a Finder window and navigate to sample client code. Double click on the ClientBackendIOSClient.xcodeproj file to open in Xcode.

  3. Update the bundle ID to match the ID used to create the SSL certificate and the Provisioning Profile:

    • Select CloudBackendIOSClient in the project navigator.
    • Update the current Bundle Identifier from com.google.CloudPushSample.dev to the bundle ID used to create the provisioning profile.
      Bundle Id in Xcode
  4. Locate the file Constants.m in the project navigator and open it.
    Constants.m in Xcode
  5. Update the values based on the Client ID from the API Console created in the previous section:
    • Update kCloudBackendClientID to match with the Client ID .
    • Update kCloudBackendClientSecret to match the Client Secret .
    • Replace { { { INSERT APP ID}}} in kCloudBackendServiceURL to your Project ID .

Update the code signing certificate

  1. Select the project in the Project Navigator .
  2. Click on the project in the Settings browser .
  3. Click on the Build Settings tab.
  4. Browse down to Code Signing Identity .
  5. Select a valid code signing certificate (APNS enabled provisioning profile).

Code Signing Profile

Run the sample

  1. Select [Your bundle ID] > iOS Device on the top left corner of the toolbar.
  2. Click the Run button to execute the application.
  3. Sign into your Google Account if the Google login page shows.
  4. Click on the the "+" sign on the top right corner and enter a message. Hit return to send the message.

  5. The app will refresh and show the latest message. You can also use the pull down gesture to refresh the list manually. Note that each time when there is a new message or update sent to the backend, this application will be notified by push notification which triggers this application to query against the backend. You can test this by entering a new message and immediately hitting the home key to navigate away from this application. Within seconds, you will receive a push notification alerting you that a message is received. When you navigate back to the application, you will see the latest message being queried and displayed.

This completes the setup for the Mobile Backend sample app.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.