Generating code signing files Tweet
You'll need two kinds of files to sign your app: Certificates and Provisioning Profiles.
Generate a Code Signing Certificate¶
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 for you if you don't have one already. Apple will then verify the information, and create a certificate for you.
Generate a Code Signing Certificate using 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 step 6.
- Start Xcode
- Select Xcode > Preferences from the navigation bar.
- At the top of the window select
Accounts
. - Click on the
+
on the lower left corner and selectAdd Apple ID...
- 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 selectingCreate Apple ID
. - Select your Apple ID and your team from the right side bar, then click on
View Details...
. - A dialog will appear where you will see your code signing identities and the provisioning profiles.
- Under the signing identities locate the
iOS Development
andiOS Distribution
profiles. If you have not created them you will see aCreate
button next to them. Simply select it and Xcode will issue and download your code signing identities for you.
Warning
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!
Generate a Code Signing Certificate manually¶
- Open your
Keychain Access
app on macOS. - Select
Keychain Access
>Certificate Assistant
>Request a Certificate From a Certificate Authority...
- Fill in the
User's Email Address
and theCommon Name
and selectSaved to Disk
. Click onContinue
and save the generatedcertSigningRequest
file locally. - Go to https://developer.apple.com and log in to your account.
- Select
Certificates, IDs & Profiles
from the left sidebar. - Go to
Certificates
and click on the+
button on the top right corner. - Select
iOS App Development
and click Continue. - On the next page you see the instructions for creating the
certSigningRequest
file. Click continue. - Upload the created
certSigningRequest
to the form and click continue. It will generate your code signing certificate for you. - Download the certificate and double click to install it. Once installed it will be added to your
Keychain Access
app.
Generate a Provisioning Profile¶
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 lets you distribute your app to the App Store and Ad-hoc profiles are good for distributing to your testers.
Generate 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.
- Select your project file from Xcode's project navigator
- Go to the
Signing
section and under theTeam
select your correct team.
Note
If you hit any issues and can't resolve it move to the manual step and set up Provisioning Profiles following the documentation.
Note
To setup a distribution Provisioning Profile, go ahead with the manual setup.
Download a Provisioning Profile with Xcode¶
If you have already created the Provisioning Profile, you can do the following.
- Start Xcode
- Select Xcode > Preferences from the navigation bar.
- At the top of the window select
Accounts
. - Select your Apple ID and your team, then select
Download Manual Profiles
. - Go to
~/Library/MobileDevice/Provisioning Profiles/
and your profiles should be there.
Generate a Provisioning Profile manually¶
Setup an App ID¶
- If you haven't already created an App ID for your project, go to https://developer.apple.com and log in.
- Select Certificates, Identifiers & Profiles from the left sidebar
- Navigate to Identifiers > App IDs
- In the
App ID Description
add a recognizable name for your App ID - Select
Explicit App ID
and add your bundle identifier to the field. - Select any additional
App Services
that you need. - Click continue.
Generate a Provisioning Profile¶
- Go to https://developer.apple.com and log in.
- Select Certificates, Identifiers & Profiles from the left sidebar
- Navigate to Provisioning Profiles > All
- Select the
+
from the top right corner. - For development select the correct project type under
Development
, or for distribution select the correct one underDistribution
and click continue. - Select the App ID you would like to use.
- Select the certificates you wish to include in the Provisioning Profile. These certificates will be able to build with this profile; click continue.
- Select all the devices you would like to use with this profile and click continue.
- Name your Provisioning Profile and click continue.
- Your profile is generated. You can download it to your device and double click to install it on your Mac.
Download a Provisioning Profile¶
- Go to https://developer.apple.com and log in.
- Select Certificates, Identifiers & Profiles from the left sidebar
- Navigate to Provisioning Profiles > All
- Find the Provisioning Profile you are looking for from the list or use the search to filter.
- Click on the selected Provisioning Profile, this will expand the details.
- If its status is invalid, you can click on the
Edit
button and save again. - Click on the
Download
button to download it and double click to install it on your Mac.
-
Screenshots from https://developer.apple.com/support ↩
Tweet