This article shows how to configure, build, and publish a Xamarin.iOS application for distribution via the iTunes App Store. It includes a step-by-step guide that covers how to prepare your application for distribution, how to use Apple’s tools to submit your application for review, and finally how to publish your application to the App Store.
In order distribute applications to all iOS devices, Apple requires apps to be published through the iTunes App Store. This makes the iTunes App Store the one-stop shopping location for iOS applications, as you are probably well aware. With over 500,000 applications in the store, developers of many types of applications have been able to capitalize on the massive success of this single point of distribution. The App Store is a turnkey solution, offering app developers both distribution and payment systems.
The process of submitting an application to the App Store involves:
- Creating a Distribution Provisioning Profile.
- Using this profile to build your application.
- Submitting your application through iTunes Connect.
In this article we will cover all the steps needed to provision, build, and submit an application for App Store distribution.
Before you Submit
The first thing that happens to your application after you submit it for publication to the App Store is for it to go through a review process by Apple to insure it meets Apple’s guidelines for quality and content. If your application fails to meet these guidelines, Apple will reject it, at which time you will need to address the non-conformance cited by Apple, and then resubmit. Therefore, you stand the best chance of making it through Apple review by familiarizing yourself with these guidelines and trying to adapt your application to them. Apple’s guidelines are available at: https://developer.apple.com/appstore/resources/approval/guidelines.html.
A couple things to watch out for when submitting an app are:
- Make sure the application’s description matches the functionality included in the app.
- Test that the application doesn’t crash under normal usage. This includes usage on every device you support.
Apple also maintains a list of App Store submission tips. You can read these at https://developer.apple.com/appstore/resources/submission/tips.html.
Additionally, to help with beta testing, Xamarin Studio provides integrated support for TestFlight. For information about how to use TestFlight, see testflightapp.com and http://docs.xamarin.com/ios/tutorials/TestFlight_Support.
Building for App Store Distribution
In order to publish an application to the App Store, you first need to build it for distribution. Building for distribution involves creating a distribution provisioning profile and then using that to create a distribution build. Let’s go through all the steps involved to create a distribution build.
Creating and Installing a Distribution Profile
iOS uses provisioning profiles to control how a particular application build can be deployed. These are files that contain information about the certificate used to sign an app, the Application ID, and where the app can be installed. For development and ad-hoc distribution, the provisioning profile also includes the list of allowed devices to which you can deploy the app. However, for App Store distribution, only certificate and app ID information are included, since the only mechanism for public distribution is through the App Store.
iOS provisioning profiles are managed through a web-based tool called the iOS Provisioning Portal. To access the portal, log in to the iOS Dev Center at developer.apple.com and click iOS Provisioning Portal in the list on the right. You should use Safari to access the portal, as it doesn’t work well in other browsers. Here’s a screenshot of the portal:
For App Store distribution, you need to create an Application ID and a distribution profile for the application in the provisioning portal. You’ll associate the distribution profile with the application ID you create.
Follow these steps to create an application ID and a distribution profile:
- In the iOS Provisioning Portal, select App IDs in the left-hand pane.
- Enter a Description, Bundle Seed ID, and Bundle Identifier, and then
click Submit. An example for an application called LiveDemo is shown
- Select Provisioning in the left-hand pane.
- Select the Distribution tab, and then select New Profile.
- Select App Store for the Distribution Method.
- Enter a Profile Name used to identify the distribution profile in the portal.
- Select your Distribution Certificate from the drop-down list.
- Select the App ID created in step 2, and then click Submit.
The completed iOS Distribution Provisioning Profile screen for the MonkeySpace app is shown below:
After creating the provisioning profile, you need to download and install it on your Mac, which you can do as follows:
- Under the Distribution tab, select the Download button next to the provisioning profile you just created.
- After your provisioning profile has downloaded, drag-drop the downloaded profile file onto the Xcode icon in the Dock to install it.
With the distribution provisioning profile created and installed, you can now use it to create a distribution build for App Store publication, as shown in the next section.
Creating a Distribution Build Configuration
Now let’s build a Xamarin.iOS application that can be published to the App Store. First, you’ll need to add a new build configuration to the Xamarin Studio solution. This new configuration will use the distribution profile you created and installed in the previous section to sign the application for App Store distribution.
Adding the Build Configuration
Follow these steps to create the build configuration:
- Double-click on the solution in the Solution Explorer to display the Solution Options dialog.
- Select Build > Configurations in the left-hand pane.
- Under the General tab, select Add.
- In the New Configuration dialog, give the configuration a
name, such as AppStore, and then select iPhone as the
Platform, (iPhone actually means iOS device in this context) as
- Click OK in the Solution Options dialog.
Configuring the Build Configuration for your Application
- Back in the Solution Explorer, right-click the project and then select Options.
- Select Build > iOS Build and then choose the newly
created AppStore configuration. Set any additional build settings your
application may need for the AppStore configuration, such as Additional
mtouch arguments, in this dialog:
- Select iOs Bundle Signing in the left-hand pane.
- For the AppStore configuration, set the Identity to
Distribution (Automatic) and then select the Provisioning
profile you installed earlier, as shown below for the LiveDemo
- Select iOS Application in the left-hand pane.
- On the Summary tab, under the iOS Application
Target section, set the Application name,
Identifier, and the Version and Devices. The
Identifier must be the same value that was set for the Bundle Identifier when
you created the provisioning profile, as shown below for the LiveDemo
- For an application distributed in the App Store, you should also include application icons. See the document Working with Images for more information.
- Click OK in the Project Options dialog.
- In Xamarin Studio, set the Build Target drop-down list to the newly created
AppStore|iPhone configuration in the top toolbar, as shown
- Select Build > Build All from the main menu to build the application. You should always ensure that the application builds without errors before creating an Archive to distribute.
If the application builds successfully you are ready to upload it to the App Store, which is the topic of the next section.
Publishing your Application to the App Store
Applications are published to the App Store by using the iTunes Connect website along with the Xcode Archive Tool, which is included with the iOS SDK. iTunes Connect is available at https://itunesconnect.apple.com.
Apple offers an integrated build and deployment mechanism in Xcode called Archiving. Xamarin Studio 3.0 can integrate with this feature to simplify the deployment process.
Some of the advantages of deploying via Build & Archive:
- App can be validated before uploading.
- Crash reports can be symbolicated for that release (if the corresponding Archive has been saved).
Build & Archive can be used to:
- Deploy to the App Store.
- Build for Ad-hoc Distribution.
- Build for Enterprise Deployment.
- Export for later use.
This section is going to explain how to Deploy to the App Store using the Xcode Organizer’s Archive feature.
Before starting, you should have a distribution certificate (either Deployment, Enterprise or Ad-hoc) from the iOS Provisioning Portal. Review the document Creating and Installing a Distribution Profile.
To deploy an application to the App Store, it must be configured in iTunes Connect (if you are building for Ad-hoc or Enterprise deployment this step can be skipped). See the Creating Your App Record in iTunes Connect for instructions. Once the application has been set-up, the application page will appear as shown:
Press the Ready to Upload Binary button, and progress through the questions.
The final screen indicates that iTunes Connect is ready for the application bundle to be uploaded. The text on the screen suggests using Application Loader, however the bundle can also be uploaded via the Archive tool.
When the status is Waiting for Upload the application binary can be deployed via the Archive tool.
The process to deploy an app using the Archive tool is discussed in the following sections.
A Distribution profile should be used, otherwise the tool can’t sign the code and it will not be able to be installed onto non-test devices.
Xamarin Studio will attempt to choose the correct Provisioning profile based on the Bundle ID and the developer’s Identity; however you can manually select a specific Provisioning profile via the menu item Project > Options > iPhone Bundle Signing, as shown here:
To archive the current application, select Xamarin Studio’s Build > Archive menu item.
The status bar will display the build progress. When complete, the Archives tab will be displayed.
The Archives tab displays a list of archived applications. Click on an app to see application details and the individual archives that have been built. Comments can be added to the archive (eg. make a note of why the archive was created, such as for a beta test release, or an App Store production deployment). Comments are useful because it is a good idea to keep archives (especially those released to the App Store or an Enterprise deployment) because it will allow you to symbolicate.
Once the archive has been created in Xamarin Studio, switch to Xcode for deployment options.
Start Xcode and then open the Organizer from the Window menu.
In the Organizer, choose the Archives tab. This screen shows the same list of applications on the left as the Archives tab in Xamarin Studio, and provides options to validate and distribute an archive:
The following steps apply to both validation and distribution (except where noted). Both buttons start a ‘wizard’ that guides you through the process. The first step is to choose which type of distribution:
For App Store submissions Xcode needs to login to iTunes Connect. Enter your Apple ID and password:
Xcode retrieves a list of applications configured in iTunes Connect with a status of ‘Waiting for Binary’. Choose the correct application from the list:
Xcode will then proceed to upload the application:
If you had chosen Validate… then this is the result you hope to see:
If you are in the process of distributing your app, it will then be uploaded to iTunes Connect:
Once the upload is complete, this message will appear to confirm that the application submission has been successful and is now in the queue for review:
Now you just wait for Apple’s review team to approve your application and publish it on the App Store!
If you chose to distribute your app, the status in iTunes Connect should now show that it is Waiting for Review (it may temporarily read Upload Received while it is processed):
When new versions of an application are built and archived they will be added to the list in the Archives tab. Adding a comment to each archive will help keep track of what each bundle was for. This screenshot shows the archive tab after a subsequent build has been archived:
It is recommended that archives deployed to customers (either App Store or Enterprise deployments) are kept, so that any debug information that is generated can be symbolicated at a later date.
If there is a problem with the provisioning profiles on your computer the following message will appear during the validation or distribution process. Use the buttons to update your identity and provisioning profiles, or visit the iOS Provisioning Portal directly to download the correct certificates and provisioning profiles.
This article presented a step-by-step guide to configuring, building, and submitting an application for App Store publication. First, it covered the steps needed to create and install a distribution provisioning profile. Next, it walked through how to use Xamarin Studio to create a distribution build. Finally, it showed you how to use iTunes Connect and the Xcode Archive Tool to submit an application to the App Store.