Publishing your Xamarin app to Apple Store
Published: 2023-09-16 12:49:29

## 1 Introduction
Cross platform mobile application development is a growing phenomenon due to its single code approach. Development of cross platform application with these new technologies is quick, but what matters more is how the apps that are developed on a single code base can be published to the respective application stores, what all kinds of testing is required for it and many more. This paper helps to cover these topics which will be useful to test single code base Applications before they are published to the App Stores.

## 2 Submitting an iOS application

## 2.1 Preparing an application for release

## 2.1.1 Set up AppID and Entitlements 
An AppId is needed for submitting an application to Apple App Store. AppId is unique for every iOS App.  Every AppId is associated with a set of entitlements. To generate an AppId, follow the below process.
1. Login to Apple Developer Portal and click on ‘Certificates, IDs and Profiles’.

![Login to Apple Developer Portal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y72nmf2r4ml0cbkzf56w.png)

2. Click on the ‘Identifiers’ option from the side menu and Click the Add button.

![Identifiers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ddp6fpbmws0edxwydfv.png)

3. Select ‘AppId’ from the list and click on ‘Continue’. Give a ‘BundleID’ and Description in the required boxes.

![AppId and BundleId](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/skugpqszj2myow1og79d.png)

4. Select the ‘Capabilities’ from the list below. Capabilities are defined as the permissions to the application to the services provided by Apple like CloudKit, In-App purchases etc.


![Capabilities](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o2zv3k98ixlx32o8jf6u.png)

## 2.1.2 Set up App Store Provisioning Profile
Provisioning profile is used to control how the application is deployed. A developer can create profiles like Alpha, Beta and Production to have an efficient release of the application to a selected set of people. To create a Provisioning Profile, click on the Profiles option in the side menu.

![Set up App Store Provisioning Profile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kxfq8mvbjoz6a2o9igkj.png)

Click on the ‘+’ icon to create a new profile. On the next screen, select ‘iOS App Development’ radio button. In the Distribution section, there are various options.

**1. Ad Hoc: **
This option can be considered as Beta release where the build is only available for a limited number of registered devices.

**2. Developer ID:**
This option can be considered as Alpha release where the build is only available for devices with same AppleID signed devices.

**3. App Store:**
This option can be considered as Production release, as the build is available on the App Store and can be accessed by the public.


![Register a new profile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7w30o9rc00gmmm4b10qd.png)

## 2.1.3 Prepare the set up for building the application
After the development stage of the application is complete, the next step is to publish the app to App Store. Building an iOS app requires a Mac Book or a Mac Build Host setup. This is required because building Native iOS requires Apple’s Build tools which only is compatible with Mac.

## 2.1.4 iOS Build Configuration
Considering Visual Studio as the IDE, right click the Project Name and click properties. Navigate to the iOS build tab. 
1. Set the Configuration to ‘Release’ and Platform to ‘iPhone’.


![Build Configuration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ql45v9ads8uwsvvwh6ei.png)

2. If the app is targeted to a specific SDK version, select it from the dropdown, else keep it ‘Default’.

![SDK Version](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/55tpvc8qemd73xxw21a6.png)

3. Linker behavior is the property which helps in reducing the size of the application by deleting the unused code. Mostly, this should be set to ‘Link Framework SDKs only’ to avoid any issues with third party libraries.


![Linker](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6js2otg7khw9whh7uo0i.png)

4. The targeted architecture is to be selected in the ‘Supported Architecture’ dropdown. All apps targeted to iOS11 and above need to support 64-bit architectures.

![Targeted Architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x540mh51t3hg1s6i52z5.png)

5. LLVM (Low Level Virtual Machine) compiler can be used to build smaller and faster code. This increases the compile time of the application.

6. Optimize PNG images can be checked to further reduce the size of the application

## 2.1.5 iOS Bundle Signing
1. Click on the ‘iOS Bundle Signing’ option from the side menu.

![IOS Bundling stage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8x0q6ofr6iwg0n5ycbfp.png)

2. Set the configuration to ‘Release’ and Platform to ‘iPhone’.

![Release Platform ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aac4dopz8bnb5bu5gcue.png)

3. Select the ‘Manual Provisioning’ radio button in the Bundle Signing Scheme. Selecting this option enables to manually map the Generated AppId from the Developer Account portal to the application.

4. In the ‘Manual Provisioning’ section, set the ‘Signing Identity’ as ‘Distribution (Automatic)’.

![Signing Identity](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d2h5mvy9t8sb3fmzce7f.png)

5. Select the ‘Provisioning Profile’ wherein the application is to be released.


![Provisioning Profile](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wm79wrllz15o5bvh8jix.png)

6. Save the configuration and close it.

## 2.2 iTunes Connect

iTunes connect is a suite of web-based tools provided by Apple for managing iOS Applications on the App Store.

## 2.2.1 Configuring an App in iTunes Connect
Create a new App on iTunes connect using the ‘+’ button.

![iTunes Connect](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jeeu743c9dgqvrws0d42.png)

Upon clicking the ‘+’ button, a prompt asks for information as below:
a. Platform: iOS / tvOS
b. Name 
c. Primary Language of the Application
d. Bundle ID
e. SKU (Unique Identification for the app)
f. User Access (Choosing the audience)


![Platform](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5aieekk7zr0qkxxbedy7.png)


## 2.2.2 Provisioning an App for App Store Distribution
Irrespective of the release plan, a Distribution profile is needed for releasing an app to App Store. This profile allows the application to be digitally signed for release so that it can be installed on an iOS device. A Distribution Profile contains the following things.
1. App Id
2. Distribution Certificate

## 2.2.2.1 Creating a Distribution Certificate
Click on the ‘Certificates, Identifiers and Profiles’ Section on the side menu. Then select ‘Certificates’ from the side menu and click ‘+’ button.


![Distribution Certificate](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/02kyorvys4x6vv37byr9.png)

Select the ‘iOS App Development’ in the Software Section.

![iOS App Development](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5bn9i6906t190bkny84b.png)

Also select the services that are being used by the application.

![services](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7bxoy7iec6wyiicjhrw.png)

## 2.2.2.2 Creating a Certificate Signing Request (CSR)
Certificate Signing Request is created using the Keychain Access tool on Mac. In the dropdown menu, click Keychain Access > Certificate Assistant > Request Certificate from a Certificate Authority.

![Certificate Signing Request (CSR)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9kvm3nmjfcm6w3q3kpjh.png)

Enter the Email ID and name associated with the Apple Account and check ‘Save to Desktop’ and click continue.

![Apple Account login](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k8w87umdolnv4oxcs9q3.png)

Once the CSR certificate is created, upload the certificate to Apple Developer Account page and click on Generate.


![CSR certificate](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0oh8dfcftswzjpbjgdp1.png)

Download the certificate and install it. Once the certificate is installed, the app can be published to the App Store.

## 2.2.3 Publish and Submit the App to App Store
1. When all the release and build configuration is complete, set the Solution Configuration to Release and Solution Platform as iPhone.


![Release](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ldjqq5bscm0gzlkmazg.png)

2. From the Build menu, select Archive. Archive Manager will pop up. Once the archive is created click on ‘Distribute’.


![Build Menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dlmm54cz4r0pchz0xhpy.png)

3. After clicking Distribute, Publishing Wizard will open. Select the desired Distribution Channel and fill the identity details and Provisioning Profile name.


![Distribute](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p7m2x5cnsm3srwylv412.png)

4. Click on ‘Upload to Store’. A prompt will ask for Apple ID and Password. Fill in the ID and Password and click ‘OK’. The app will start to upload to App Store.


![Credentials](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/chg4oyyr7arl51udbptt.png)

5. Once the upload is complete, login to iTunes and select the app. It will show the status as ‘Waiting for review’ with version details.

![Versions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b33ode6905j4wk830x4e.png)

## 2.2.4 Managing App Screenshots
For publishing an app, App Store requires a set of screenshots and videos (optional). The screenshot consist of actual views of the application running and showing the unique features. Apple requires screenshots for every screen size and resolution that the application supports.