Skip to main content

Generating iOS code signing files

Abstract

You can generate iOS code signing files either with Xcode or on the Apple Developer Portal.

You’ll need two kinds of files to sign your app: certificates and provisioning profiles.

The certificates - development or distribution - are the guarantee that you, the named developer, built this code, that you are a member of the developer program, and that Apple have issued you with a certificate to do so.

To get a certificate, you need to generate a Certificate Signing Request with Keychain Access and send it to Apple. This will create a public/private key pair for you if you don’t have one already. Apple will then verify the information, and create a certificate for you.

Provisioning is the process of preparing and configuring an app to launch on devices and to use app services. Development provisioning profiles holds the device identifiers (UUID) that is eligible to run your app. Distribution provisioning profiles can include App Store profiles that allow you to distribute your app to the App Store. Ad-hoc profiles are good for distributing to your testers.

Generating a code signing certificate with Xcode

First you have to add your Apple ID to Accounts preferences in Xcode. If you are already done with this, you can skip to Selecting your Apple ID.

  1. Start Xcode.

  2. Select Xcode > Preferences from the navigation bar.

  3. At the top of the window select Accounts.

  4. Click on the + on the lower left corner and select Add Apple ID…

    Adding Apple ID
  5. A dialog will appear. Add your Apple ID and your password, then select Sign in. If you don’t have an account you can create your Apple ID by selecting Create Apple ID.

    Sign in to Xcode
  6. Select your Apple ID and your team from the right side bar, then click on View Details….

  7. A dialog will appear where you will see your code signing identities and the provisioning profiles.

    Xcode team details
  8. Under the signing identities locate the iOS Development and iOS Distribution profiles. If you have not created them you will see a Create button next to them. Simply select it and Xcode will issue and download your code signing identities for you.

When to click Reset next to Code Signing Identities

If you already have Code Signing Identities issued, you will see a Reset button next to them. You can issue new certificates with it, that Xcode will generate and download, however note that this will invalidate your previous certificate, so only do this if you’ve lost those files or if you know what you are doing!

Generating a code signing certificate manually

  1. Open your Keychain Access app on macOS.

  2. Select Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority…

  3. Fill in the User’s Email Address and the Common Name and select Saved to Disk.

  4. Click on Continue and save the generated certSigningRequest file locally.

    Certificate Assistant
  5. Go to https://developer.apple.com and log in to your account.

  6. Select Certificates, IDs & Profiles from the left sidebar.

  7. Go to Certificates and click on the + button on the top right corner.

  8. Select iOS App Development and click Continue.

  9. On the next page you see the instructions for creating the certSigningRequest file. Click Continue.

  10. Upload the created certSigningRequest to the form and click Continue. It will generate your code signing certificate for you.

  11. Download the certificate and double click to install it. Once installed it will be added to your Keychain Access app.

Generating a provisioning profile with Xcode

Xcode will automatically generate an App ID for your project, that matches your unique bundle ID for your project. An App ID is used to identify one or more of your apps. It can be an explicit App ID that only matches one unique bundle identifier or a wildcard App ID that can match multiple ones.

Xcode will also create a Team Provisioning Profile for your project automatically, so you can start deploying to your device automatically.

If you hit any issues you should make sure that the device is eligible, for example if the device doesn’t match the deployment target you will get an error. Also make sure that your app is connected to the correct Team.

To generate a provisioning profile using Xcode:

  1. Select your project file from Xcode’s project navigator.

  2. Go to the Signing section and under the Team select your correct team.

    Team selector
  3. Build your project in Xcode.

To download a provisioning profile from Xcode:

  1. Start Xcode.

  2. Select Xcode > Preferences from the navigation bar.

  3. At the top of the window select Accounts.

  4. Select your Apple ID and your team, then select Download Manual Profiles.

  5. Go to ~/Library/MobileDevice/Provisioning Profiles/ and your profiles should be there.

Generating a provisioning profile manually

To generate a provisioning profile manually, you need a working Apple Developer account, and you need to set up an App ID for your project.

Setting up an App ID

  1. If you haven’t already created an App ID for your project, go to https://developer.apple.com and log in.

  2. Select Certificates, Identifiers & Profiles from the left sidebar.

  3. Navigate to Identifiers > App IDs.

  4. In the App ID Description add a recognizable name for your App ID.

  5. Select Explicit App ID and add your bundle identifier to the field.

  6. Select any additional App Services that you need.

  7. Click Continue.

Generating a provisioning profile

  1. Go to https://developer.apple.com and log in.

  2. Select Certificates, Identifiers & Profiles from the left sidebar.

  3. Navigate to Provisioning Profiles > All.

  4. Select the + from the top right corner.

  5. For development select the correct project type under Development, or for distribution select the correct one under Distribution and click continue.

  6. Select the App ID you would like to use.

  7. Select the certificates you wish to include in the provisioning profile. These certificates will be able to build with this profile; click Continue.

  8. Select all the devices you would like to use with this profile and click continue.

  9. Name your provisioning profile and click Continue.

  10. Your profile is generated. You can download it to your device and double click to install it on your Mac.