This tutorial shows how to add Azure Mobile Apps, a cloud backend service, to an iOS app. We'll first create a new mobile backend. Then, we'll use a simple Todo list iOS app to store data in Azure.
To complete this tutorial, you need a Mac and an Azure account
Step I: Create a new Azure mobile app backend
- Log in at the Azure Portal.
Click +NEW and type Mobile Apps in Search the marketplace. Select Mobile Apps Quickstart and click Create.
- For the Resource Group, select an existing resource group, or create a new one (using the same name as your app.)
- Click Create. Wait a few minutes for the service to be deployed successfully before proceeding.
Step II: Configure the backend project
- Click App Services > select your Mobile App backend > click Quickstart > your client platform (iOS, Android, Xamarin, Cordova).
- If the connection to the database is not configured, you must create one Data Connection.
Create new SQL Database and server.
Wait until the data connection is successfully created.
Data connection must be successful.
- Under 2. Create a table API, select Node.js for Backend language. Accept the acknowledgment and click Create TodoItem table. This creates a new TodoItem table in your database. Remember that switching an existing backend to Node.js will overwrite all contents! To create a .NET backend instead, follow these instructions.
Step III: Download and run the iOS app
- On your Mac, visit the Azure Portal. Click Browse All > Mobile Apps > the backend that you just created. In the mobile app settings, click Quickstart > iOS (Objective-C). If you prefer Swift, click Quickstart > iOS (Swift) instead. Under Download and run your iOS project, click Download. This downloads a complete Xcode project for an app pre-configured to connect to your backend. Open the project using Xcode.
- Press the Run button to build the project and start the app in the iOS simulator.
In the app, type meaningful text, such as Complete the tutorial and then click the plus (+) icon. This sends a POST request to the Azure backend you deployed earlier. The backend inserts data from the request is into the TodoItem SQL table, and returns information about the newly stored items back to the mobile app. The mobile app displays this data in the list.