Creating code signing files

How to code sign iOS apps

Creating code signing files

You can have Xcode manage your signing files automatically by enabling its automatic signing feature. This is a good option if you’re developing locally. However, as soon as you need to set up the build on a remote machine, such as the CI server, you may have to switch to manual code signing in Xcode and manage provisioning profiles and signing certificates yourself.

Creating code signing certificates using Xcode

Instructions in this guide are based on Xcode 12. If you’re using an earlier version of Xcode, the steps may vary slightly.

  1. Open Xcode and navigate to Xcode > Preferences… > Accounts, and if you don’t already have an account set up with Xcode, click the add (+) button to add a new account.
  2. Select Apple ID as the account type and click Continue.

Select Apple Id as the account type

  1. You will be prompted to sign in with your Apple ID. Fill in your Apple ID and password and click Next.

Sign in with your Apple ID

If your account has two-step authentication or two-step verification enabled, you will be asked to verify your identity. Once you do that, you’ll see your account listed.

  1. Select your personal or team account and then click Manage Certificates…

Select your personal or team account and then click Manage Certificates…

  1. You’ll see the list of existing certificates you have available. Click the + button on the dialog to add a new certificate.

Add a new certificate…

Once the certificate is created, you can also see it added to keychain. Your team certificates will also appear in the Certificates, Identifiers & Profiles section of your team account in Apple Developer Portal.

Creating provisioning profiles

If you use Xcode’s automatic signing feature, Xcode manages development provisioning profiles for you.

Before you can create a provisioning profile in Apple Developer Portal, go through this checklist of requirements.

Requirements:

  • You have to be Account Holder or Admin to be able to create provisioning profiles.
  • You need to have one or more certificates available in Apple Developer portal.
  • You need to have registered an App ID in Apple Developer portal.
  • You should have registered devices available in Apple Developer portal.
  1. Log in to Apple Developer portal, and in Certificates, Identifiers & Profiles, select Profiles from the left menu.
  2. Click on the + button at the top of the page to add a new profile.
  3. Select the type of the certificate to create and click Continue.
  4. Select the App ID you want to use and click Continue.
    • Make sure the App ID matches your bundle ID.
    • Note that in order to create an App Store provisioning profile, you need to use an explicit App ID.
  5. Select the certificate(s) to be included in the profile.
    • If it’s a development provisioning profile, you can select multiple development certificates. Everyone using those certificates would be able to build the app with that profile.
    • If you’re creating an Ad Hoc or App Store provisioning profile, select a single distribution certificate to be included in the profile.
  6. In the case of Development and Ad Hoc profiles, select the device(s) to be included in the profile. (This step is skipped for App Store profiles.)
  7. Provide a profile name and click Generate.
  8. Finally, click Download.