Create a Xamarin.iOS app
This tutorial shows you how to add a cloud-based backend service to a Xamarin.iOS mobile app by using an Azure mobile app backend. You create both a new mobile app backend and a simple Todo list Xamarin.iOS app that stores app data in Azure.
Completing this tutorial is a prerequisite for all other Xamarin.iOS tutorials about using the Mobile Apps feature in Azure App Service.
To complete this tutorial, you need the following prerequisites:
- An active Azure account. If you don't have an account, sign up for an Azure trial and get up to 10 free mobile apps that you can keep using even after your trial ends. For details, see Azure Free Trial.
- Visual Studio with Xamarin. See Setup and install for Visual Studio and Xamarin for instructions.
- A Mac with Xcode v7.0 or later and Xamarin Studio Community installed. See Setup and install for Visual Studio and Xamarin and Setup, install, and verifications for Mac users (MSDN).
Create an Azure Mobile App backend
Follow these steps to create a Mobile App backend.
Sign in to the Azure portal.
Click Create a resource.
In the search box, type Mobile Apps.
In the results list, select Mobile Apps Quickstart, and then select Create.
Choose a unique App name. This will also be part of the domain name for your App Service.
Under 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. Watch the Notifications (bell) icon in the portal header for status updates.
Configure the server project
You have now provisioned an Azure Mobile App backend that can be used by your mobile client applications. Next, download a server project for a simple "todo list" backend and publish it to Azure.
Follow the following steps to configure the server project to use either the Node.js or .NET backend.
Click the App Services button, select your Mobile Apps back end, select Quickstart, and then select your client platform (iOS, Android, Xamarin, Cordova).
If a database connection is not configured, create one by doing the following:
a. Create a new SQL database and server. You may need to leave the connection string name field to the default value of MS_TableConnectionString in order to complete step 3 below.
b. Wait until the data connection is successfully created.
c. Data connection must be successful.
Under 2. Create a table API, select Node.js for Backend language.
Accept the acknowledgment, and then select Create TodoItem table. This action creates a new to-do item table in your database.
Switching an existing back end to Node.js overwrites all contents. To create a .NET back end instead, see Work with the .NET back-end server SDK for Mobile Apps.
Download and run the Xamarin.iOS app
Open the Azure portal in a browser window.
On the settings blade for your Mobile App, click Get Started > Xamarin.iOS. Under step 3, click Create a new app if it's not already selected. Next click the Download button.
A client application that connects to your mobile backend is downloaded. Save the compressed project file to your local computer, and make a note of where you save it.
Extract the project that you downloaded, and then open it in Xamarin Studio (or Visual Studio).
Press the F5 key to build the project and start the app in the iPhone emulator.
In the app, type meaningful text, such as Learn Xamarin, and then click the + button.
Data from the request is inserted into the TodoItem table. Items stored in the table are returned by the mobile app backend, and the data is displayed in the list.
You can review the code that accesses your mobile app backend to query and insert data in the QSTodoService.cs C# file.
Send feedback about: