Skip to content

Latest commit

 

History

History
154 lines (101 loc) · 8.27 KB

mobile-services-get-started-ios.md

File metadata and controls

154 lines (101 loc) · 8.27 KB

Azure Chunk Displayer
No macro content available for WYSIWYG editing

Get started with Mobile Services for iOS

This tutorial shows you how to add a cloud-based backend service to an iOS app using Windows Azure Mobile Services. In this tutorial, you will create both a new mobile service and a simple To do list app that stores app data in the new mobile service.

A screenshot from the completed app is below:

Completing this guide is a prerequisite for all other Mobile Services tutorials for iOS apps.

Note

To complete this tutorial, you need a Windows Azure account that has the Windows Azure Mobile Services feature enabled.

Create a new mobile service

Follow these steps to create a new mobile service.

  1. Log into the Management Portal.

  2. At the bottom of the navigation pane, click +NEW.

  3. Expand Mobile Service, then click Create.

    This displays the New Mobile Service dialog.

  4. In the Create a mobile service page, type a subdomain name for the new mobile service in the URL textbox and wait for name verification. Once name verification completes, click the right arrow button to go to the next page.

    This displays the Specify database settings page.

    Note

    As part of this tutorial, you create a new SQL Database instance and server. You can reuse this new database and administer it as you would any other SQL Database instance. If you already have a database in the same region as the new mobile service, you can instead choose Use existing Database and then select that database. The use of a database in a different region is not recommended because of additional bandwidth costs and higher latencies.

  5. In Name, type the name of the new database, then type Login name, which is the administrator login name for the new SQL Database server, type and confirm the password, and click the check button to complete the process.

    Note

    When the password that you supply does not meet the minimum requirements or when there is a mismatch, a warning is displayed.
    We recommend that you make a note of the administrator login name and password that you specify; you will need this information to reuse the SQL Database instance or the server in the future.

You have now created a new mobile service that can be used by your mobile apps.

Create a new appCreate a new iOS app

Once you have created your mobile service, you can follow an easy quickstart in the Management Portal to either create a new app or modify an existing app to connect to your mobile service.

In this section you will create a new iOS app that is connected to your mobile service.

  1. In the Management Portal, click Mobile Services, and then click the mobile service that you just created.

  2. In the quickstart tab, click iOS under Choose platform and expand Create a new iOS app.

    This displays the three easy steps to create an iOS app connected to your mobile service.

  1. If you haven't already done so, download and install Xcode and the Mobile Services iOS SDK on your local computer or virtual machine.

  2. Click Create TodoItems table to create a table to store app data.

  3. Under Download and run app, click Download.

This downloads the project for the sample To do list application that is connected to your mobile service. Save the compressed project file to your local computer, and make a note of where you save it.

Run your iOS app

The final stage of this tutorial is to build and run your new app.

  1. Browse to the location where you saved the compressed project files, expand the files on your computer, and open the project file using Xcode.

  2. Press the Run button to build the project and start the app in the iPhone emulator, which is the default for this project.

  3. In the app, type meaningful text, such as Complete the tutorial and then click the plus (+) icon.

    This sends a POST request to the new mobile service hosted in Windows Azure. Data from the request is inserted into the TodoItem table. Items stored in the table are returned by the mobile service, and the data is displayed in the list.

    Note

    You can review the code that accesses your mobile service to query and insert data, which is found in the TodoService.m file.

  4. Back in the Management Portal, click the Data tab and then click the TodoItems table.

    This lets you browse the data inserted by the app into the table.

Next Steps

Now that you have completed the quickstart, learn how to perform additional important tasks in Mobile Services: