|
| 1 | +--- |
| 2 | +title: Code sign for iOS (preview) |
| 3 | +description: Learn about how to code sign for iOS for Power Apps wrap. |
| 4 | +author: larryk78 |
| 5 | +ms.topic: article |
| 6 | +ms.custom: canvas |
| 7 | +ms.reviewer: tapanm |
| 8 | +ms.date: 04/07/2022 |
| 9 | +ms.subservice: canvas-maker |
| 10 | +ms.author: lknibb |
| 11 | +search.audienceType: |
| 12 | + - maker |
| 13 | +search.app: |
| 14 | + - PowerApps |
| 15 | +contributors: |
| 16 | + - tapanm-msft |
| 17 | + - larryk78 |
| 18 | +--- |
| 19 | + |
| 20 | +# Code sign for iOS (preview) |
| 21 | + |
| 22 | +[This article is pre-release documentation and is subject to change.] |
| 23 | + |
| 24 | +In this article, you'll learn about how to code sign for iOS. You'll need to sign your app for iOS if you selected iOS as one of the [platforms](overview.md#app-platforms) while creating and building your [wrap project](how-to.md#create-a-wrap-project). |
| 25 | + |
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +You'll need the following information to get started: |
| 29 | + |
| 30 | +- App ID |
| 31 | +- Device UDIDs (only for testing and development purpose) |
| 32 | + |
| 33 | +You'll also need a macOS device to code sign for iOS. |
| 34 | + |
| 35 | +## Prepare your Mac |
| 36 | + |
| 37 | +Set up your Mac with the following configuration. |
| 38 | + |
| 39 | +1. Install **Xcode**. More information: [Xcode](https://developer.apple.com/support/xcode/) |
| 40 | +1. Install PowerShell for macOS. More information: [Installing PowerShell on macOS](/powershell/scripting/install/installing-powershell-on-macos) |
| 41 | +1. Enroll in [Apple Developer Program](https://developer.apple.com/programs/) |
| 42 | +1. To distribute your apps within the organization, you'll need to sign up for [Apple Enterprise Developer Program](https://developer.apple.com/programs/enterprise/). |
| 43 | + |
| 44 | +## Create App ID |
| 45 | + |
| 46 | +1. Sign in to your developer account by going to <https://developer.apple.com> and selecting the **Account** tab. |
| 47 | + |
| 48 | + :::image type="content" source="media/code-sign-ios/account-tab.png" alt-text="Account tab."::: |
| 49 | + |
| 50 | +1. Go to [**Certificates, IDs & Profiles > Identifiers**](https://developer.apple.com/account/resources/identifiers/list). |
| 51 | + |
| 52 | +1. Select **+** to create a new identifier. |
| 53 | + |
| 54 | + :::image type="content" source="media/code-sign-ios/identifier.png" alt-text="Create new identifier."::: |
| 55 | + |
| 56 | +1. Select **App IDs**, and then select **Continue**. |
| 57 | + |
| 58 | + :::image type="content" source="media/code-sign-ios/register-identifier.png" alt-text="Register a new identifier."::: |
| 59 | + |
| 60 | +1. Select the type as **App**, and then select **Continue**. |
| 61 | + |
| 62 | +1. Register an **App ID**: |
| 63 | + |
| 64 | + :::image type="content" source="media/code-sign-ios/register-appid.png" alt-text="Register an App ID."::: |
| 65 | + |
| 66 | + 1. **Description** - Name of your app. |
| 67 | + 1. **Bundle ID** - select **Explicit Bundle ID**. |
| 68 | + 1. Enter the bundle ID that you used while [creating the wrap project](how-to.md#bundle-id). More information: [Bundle ID](overview.md#bundle-id) |
| 69 | + 1. Enable the following capabilities: |
| 70 | + - Associated Domains |
| 71 | + - iCloud |
| 72 | + - NFC Tag Reading |
| 73 | + - Push Notifications |
| 74 | + 1. Select **Continue**. |
| 75 | + |
| 76 | +1. Review, and register the App ID. |
| 77 | + |
| 78 | +## Create a distribution certificate |
| 79 | + |
| 80 | +To create a distribution certificate, create a new certificate signing request first. |
| 81 | + |
| 82 | +### Create Certificate Signing Request (CSR) |
| 83 | + |
| 84 | +1. On your Mac PC, go to the **Applications** folder > **Utilities** > open **Keychain Access**. |
| 85 | + |
| 86 | +1. Select **Keychain Access** > **Certificate Assistant** > **Request a Certificate from a Certificate Authority**. |
| 87 | + |
| 88 | + :::image type="content" source="media/code-sign-ios/cert-req.png" alt-text="Request a certificate from a CA."::: |
| 89 | + |
| 90 | +1. Fill out the **Certificate Information** as explained below, and then select **Continue**. |
| 91 | + 1. In the **User Email Address** field, enter your Apple ID email address to identify with this certificate. |
| 92 | + 1. In the **Common Name** field, enter your name. |
| 93 | + 1. In the **Request** group, select **Saved to disk**. |
| 94 | + 1. Save the file to your Mac PC. |
| 95 | + |
| 96 | +## Create the distribution certificate |
| 97 | + |
| 98 | +1. Sign in to your developer account at <https://developer.apple.com> by selecting the **Account** tab. |
| 99 | + |
| 100 | +1. Go to [Certificates, IDs & Profiles > Certificates](https://developer.apple.com/account/resources/certificates/list). |
| 101 | + |
| 102 | + 1. Select **+** to create a new certificate. |
| 103 | + 1. Select **App Store and Ad Hoc** > **Continue**. |
| 104 | + |
| 105 | +  |
| 106 | + |
| 107 | + > [!NOTE] |
| 108 | + > If you have an Enterprise Developer Account then you'll have the option to create an Enterprise Distribution certificate. |
| 109 | +
|
| 110 | +1. Upload the Certificate Signing Request (CSR) file that was generated in the previous steps. |
| 111 | + |
| 112 | + :::image type="content" source="media/code-sign-ios/upload-cert.png" alt-text="Upload the certificate."::: |
| 113 | + |
| 114 | +1. Select **Continue**, and download the certificate to your Mac PC. |
| 115 | + |
| 116 | +1. Double-click the downloaded .cer file to install to Keychain Access. |
| 117 | + |
| 118 | +1. Take a note of the **Name** of the certificate (usually like **iPhone Distribution: Name (Team ID)**). This value is the code signing identity that needs to be provided for signing. |
| 119 | + |
| 120 | +## Add all the devices where the iPA needs to be installed |
| 121 | + |
| 122 | +1. Sign in to your developer account at <https://developer.apple.com> by selecting the **Account** tab. |
| 123 | + |
| 124 | +1. Go to [Certificates, IDs & Profiles > Devices](https://developer.apple.com/account/resources/devices/list). |
| 125 | + |
| 126 | +1. Select **+** to register one or more devices. |
| 127 | + |
| 128 | +1. Enter the **Device Name** and **Device ID (UDID)**. |
| 129 | + |
| 130 | + :::image type="content" source="media/code-sign-ios/register-device.png" alt-text="Register a device."::: |
| 131 | + |
| 132 | +1. Select **Save**. |
| 133 | + |
| 134 | + > [!TIP] |
| 135 | + > You can also register multiple devices together by uploading a list of UDID's. |
| 136 | +
|
| 137 | +## Create an iOS Provisioning Profile |
| 138 | + |
| 139 | +1. Sign in to your developer account by going to <https://developer.apple.com> and selecting the **Account** tab. |
| 140 | + |
| 141 | +1. Go to [**Certificates, IDs & Profiles > Profiles**](https://developer.apple.com/account/resources/profiles/list). |
| 142 | + |
| 143 | +1. Select **+** to create a new profile. |
| 144 | + |
| 145 | +1. Select **Ad Hoc** > **Continue**. |
| 146 | + |
| 147 | + :::image type="content" source="media/code-sign-ios/ad-hoc.png" alt-text="Ad Hoc."::: |
| 148 | + |
| 149 | + > [!NOTE] |
| 150 | + > For production testing and development purpose, use **App Store** distribution method. |
| 151 | +
|
| 152 | +1. Select App ID that you created earlier, and then select **Continue**. |
| 153 | + |
| 154 | + :::image type="content" source="media/code-sign-ios/app-id.png" alt-text="App ID."::: |
| 155 | + |
| 156 | +1. Select the certificate that you created earlier, and then select **Continue**. |
| 157 | + |
| 158 | + :::image type="content" source="media/code-sign-ios/select-cert.png" alt-text="Select certificate."::: |
| 159 | + |
| 160 | +1. Select all the test devices where you want to install your app, and then select **Continue**. |
| 161 | + |
| 162 | + :::image type="content" source="media/code-sign-ios/add-devices.png" alt-text="Add devices."::: |
| 163 | + |
| 164 | +1. Review and name the provisioning profile. Note down the name of the provisioning profile. |
| 165 | + |
| 166 | +1. Generate and download the profile to your Mac. |
| 167 | + |
| 168 | +1. Double-click to open the downloaded file (\*.mobileprovision) to register it with Xcode. |
| 169 | + |
| 170 | +## Sign the iOS Archive |
| 171 | + |
| 172 | +1. Download the .zip app package created as a result of the [wrap project](how-to.md#create-a-wrap-project). |
| 173 | + |
| 174 | +1. Unzip the package. |
| 175 | + |
| 176 | + For example, a sample build project **iOS-Archive.zip** file downloaded from the App Center shows a folder structure like below. |
| 177 | + |
| 178 | + :::image type="content" source="media/code-sign-ios/folder-structure.png" alt-text="Folder structure."::: |
| 179 | + |
| 180 | +1. Open terminal, and change directory to the folder. In this example, **com_single_wrap**. |
| 181 | + |
| 182 | +1. Enter `pwsh` to start PowerShell in the terminal. |
| 183 | + |
| 184 | +1. Run `./SignAndGenerateIPA.ps1` with the values for the "CodeSigningIdentity" and "ProvisioningProfilePath" parameters. |
| 185 | + |
| 186 | + :::image type="content" source="media/code-sign-ios/powershell.png" alt-text="Run PowerShell script."::: |
| 187 | + |
| 188 | +1. After the script finishes, you'll see an .ipa file created. In this example, **com_single_wrap.ipa**. |
| 189 | + |
| 190 | + :::image type="content" source="media/code-sign-ios/package.png" alt-text="IPA package."::: |
| 191 | + |
| 192 | +1. Install the .ipa file in the registered devices using the **Finder** app. You can also host it on a distribution service such as [App Center](how-to.md#test-and-distribute-mobile-app-package). To distribute using Microsoft Intune, see [Add an iOS/iPadOS line-of-business app to Microsoft Intune](/mem/intune/apps/lob-apps-ios). |
| 193 | + |
| 194 | +### See also |
| 195 | + |
| 196 | +- [Wrap overview (preview)](overview.md) |
| 197 | +- [Code sign on Android (preview)](code-sign-android.md) |
0 commit comments