# Getting Keystore & Mobile Provision Files

These files are required by Apple to certify an app, allowing it to run on iOS devices. Only Apple provides these files and you cannot export an iOS app from Designware without them. These instructions enable anyone to walk through the steps of getting the files from Apple.

For starters, make sure you have:

* An Apple Developer account at [developer.apple.com](http://developer.apple.com/) (and your profile within this account must be an Admin role). Apple charges a one-time fee of $120 for new Developer accounts.
* A Mac computer.
* If you want to test the app, you will also need an iOS device and a USB cable to connect it to the Mac.

If this is your first iOS app in Designware, begin here, otherwise, skip to Step D.

<details>

<summary>A) Make the "Certificate Signing Request" (.certSigningRequest) file on a Mac</summary>

This file is needed to get the Certificate (.cer) file in step B.

1. On your Mac, open the Keychain Access app (in **Applications** **›** **Utilities**)
2. In the app's menu bar, select **Keychain Access › Certificate Assistant › Request a Certificate from a Certificate Authority**
3. In the Certificate Information prompt:\\

   * Insert the Email Address to be associated with the app (can be any address).
   * Insert a Common Name (can be anything or blank).
   * Select **Save to Disk**.
   * Select **Continue**.
   * Edit the filename if desired (it doesn't matter what it is).
   * Select **Save**. A .certSigningRequest file will be saved to your Mac in the specified location.

</details>

<details>

<summary>B) Get the "Certificate" (.cer) file from Apple</summary>

This file is needed to get the Keychain (.p12) file in step C.

1. Login to your Apple Developer profile at [developer.apple.com](http://developer.apple.com/) (must be an Admin role).
2. Go to Certificates, Identifiers & Profiles.
3. In the Certificates tab, select ➕ (New Certificate).
4. Select **Apple Distribution** and **Continue**. (Note that Apple Developer accounts may limit the number of Apple Distribution certificates that can be created. Revoke any unused certificates to make room.)
5. Under Create a New Certificate, upload the .certSigningRequest file produced in step A, and **Continue**.
6. Download the new certificate (the filename can be edited, but it does not matter what it is). The .cer file will be saved to your Mac in the specified location.

</details>

<details>

<summary>C) Make the "Keystore" (.p12) file on a Mac</summary>

This file will allow any iOS app to become certified. It gets uploaded to Designware when creating a new iOS app.

1. Right-click the .cer file produced in step B, and select **Open With › Keychain Access**. Alternatively, drag and drop the .cer file into the Keychain Access app found in **Applications › Utilities**.\
   \\

   **Note:** If you’re having trouble adding the certificate:

   * Make sure your macOS is up to date.
   * Download the latest [Worldwide Developer Relations - G3](https://www.apple.com/certificateauthority/AppleWWDRCAG6.cer).\\

2. In the Keychain Access app, under the My Certificates tab, right-click the .cer file's listing and select **Export \[...]** from the menu.

3. In the export prompt:\\

   * The filename can be anything.
   * File Format needs to be **Personal Information Exchange** (.p12).
   * Select **Save**.
   * Create and verify a Keystore Password.
   * If required, insert the Mac's System Password to allow the action.

A .p12 file will be saved to your Mac in the specified location. Make sure to keep this file and its password safe, as it will be needed by Designware to create iOS apps. It can be used to make new apps in any project.

</details>

<details>

<summary>D) Registering Your iOS Test Devices</summary>

To test an iOS app on your own iOS devices (or for demos or internal-use apps), you'll need to first register those devices with your Apple Developer account. Skip to step E if you've already done this.

1. Connect your iOS device to your Mac using a USB cable.
2. In the Mac's menu bar, go to the **Apple logo › About This Mac › System Report › Hardware › USB tab**.
3. In the USB Device Tree, find and select the connected iOS device.
4. Copy the iOS Device's listed Serial Number. It will be something like "00008030000E67891EF0802E".
5. Log into your Apple Developer profile at [developer.apple.com](http://developer.apple.com/).
6. Go to the **Devices tab** and select (**New Device**).
7. Under Register a Device:\\

   * Leave the Platform set to "iOS, tvOS, watchOS".
   * Insert a Device Name that you'll recognize.
   * Copy/paste the Serial Number from step 5 into the Device ID (UDID). You may need to add a dash after the first 8 characters to validate it, like "00008030-000E67891EF0802E".
   * Select **Continue** and **Register** and **Done**.

\
The device will now appear on the devices list, making it eligible to use your iOS test apps.

</details>

<details>

<summary>E) Get the "Mobile Provision" (.mobileprovision) file from Apple</summary>

This file defines the app's purpose—either as a test app for designated iOS devices, or as an official app for distribution on the App Store.

1. Login to your Apple Developer profile at [developer.apple.com](http://developer.apple.com/) (must be an Admin role).

2. Go to **Certificates, Identifiers & Profiles**.

3. In the **Identifiers tab**, select (**New Identifier**).

4. Select **App ID** and **Continue**.

5. Under Select a Type choose **App** and **Continue**.

6. Under Registering an App ID:\\

   * Insert a Description (it can be anything, but you'll need to identify it later).
   * Leave Bundle ID defined as Explicit.
   * Insert a Bundle ID (it can be anything, but you'll be asked to redo it if the same Bundle ID already exists in Apple's database).
   * The Capabilities can be left unchecked.
   * Select **Continue** and **Register**.\\

7. Go to the Profiles tab and select ➕ (New Profile).

8. Under Register a New Provisioning Profile:\\

   * In the Distribution section (not Development) select either:\
     \
     **Ad Hoc** if you want to test the app on your own iOS devices registered in step D (recommended for a first version). This file can be used to generate test apps in any Designware project.\
     \
     **App Store** if you want to upload and distribute the app on the App Store. Your own iOS devices will only be able to get the app from the App Store. This file should only be used to publish apps for one Designware project, since it supports a single App Store listing. Repeat this step E for subsequent projects.\\

   * Select **Continue**.

   * Under Generate a Provisioning Profile, select the App ID created in step 6, and then **Continue**.

   * Select the Certificate created in step B.

   * If you are creating an Ad Hoc profile, you will also be prompted to select the registered devices that the app can be tested on. (To add new test devices in the future, you will need to make a new Ad Hoc Mobile Provision file and use it to export another app from Designware.) Select **Continue**.

   * Insert a Provisioning Profile Name (which can be anything) and select **Generate** and **Download**.

A .mobileprovision file will be downloaded to the Mac in the specified location.

</details>

On your Mac, you now have the Keystore (.p12) and Mobile Provision (.mobileprovision) files needed to export your app from Designware.

{% hint style="info" %}
When creating a new app, make sure the Keystore and Mobile Provision files were made by on the same Mac by the same Apple Developer user, or an export error can occur in Designware.
{% endhint %}
