If you have ever developed an iOS app, or even started learning about it, then you must have been a bit (or a lot) confused about the process of app provisioning. I know for sure I was. So that’s why I decided to write this article explaining what in fact are these certificates and profiles, why we need them and a step by step tutorial of how to create and use them. And hopefully it will help some lost fellow out there who’s trying to find a point to this mystic process.
So let’s dive into this! 👩💻
What are Apple certificates and provisioning profiles and why do we need them?
The certificate is a digital identification you use to sign your iOS apps for development and distribution. The main part of the certificate is your public/private key pair, which is a guarantee that the apps are truly developed/distributed by you. You've probably realized by now that you can't install any app on an iOS device. It needs to be signed by Apple first and that's why we need the provisioning profiles. You can see them as a link between the device and the developer account.
And if you’re wondering why is Apple requiring all of this? Well, because they are really focused towards providing secure devices. That's why their developers need to be registered, sign their apps and have them reviewed by Apple before any distribution. This is the process they came up with as a way to keep the security on a high level but still be accessible.
In order to create or use an existing certificate or provisioning profile login to your Apple developer account and you should see the homepage for your Apple developer program account. Navigate to Certificates, Identifiers & Profiles.
Note: every certificate and provisioning profile have an expiration date, so it’s really important to check it before using any.
In the certificates section you’ll see all of the current certificates that are made under that developer program. There are two types of certificates: Development and Distribution.
The development one is used when you want to install the app using XCode (when developing an app), and the distribution one is used for distribution of the application (TestFlight/AppStore).
If you want to use a current certificate then you can select it and download it, but you would also need to obtain the private key from the developer who created the certificate.
This example was taken from the official Apple guide
You can now save the request and add it to the request field. After this the certificate is created and you can download it. Find the downloaded certificate, double click on it and it should now appear in your Keychain.
The last step depends on whether the certificate is a distribution or development one.
The next thing we need to do if we want to develop or distribute our app is create a Provisioning profile (specific for the certificate that we just created). Each provisioning profile stores the following: certificate, an App ID (two-part string used to identify one or more apps from a single development team) and unique device identifiers (list of devices that the app can run on).
Go back to Certificates, Identifiers & Profiles and under Provisioning profiles you will see all of the current profiles that are made under that Apple developer program. There are also two types of provisioning profiles: Distribution and Development. The development one is used for testing of the application, while the distribution one is used when we want to submit our app to AppStore/TestFlight. If you want to use a current profile then you can select it and download it.
The last step here also depends on whether the certificate is a distribution or development one:
As mentioned before the certificates and provisioning profiles have their expiration dates. After the expiration date has passed, you will need to create new ones in order to keep working on your app.
With all of this set you're ready to go and develop or distribute your iOS app! 📲
Previously published at https://blog.codechem.com/apple-certificates-and-provisioning-profiles-a-mystery-resolved