Set up a Distribution certificate and an Ad Hoc provisioning profile for iOS internal distribution builds.
Here we learn how to sign Apple app builds to make them installable on Apple devices.
In order to install your own app on any Apple device, you need an Apple Developer account and a subscription to the Apple Developer Program.
[00:00] In order to create an app build that can be installed on real Apple devices, you must have an Apple developer account and also be enrolled in the Apple developer program. This is a paid subscription service from Apple and it gives you access to many develop tools including being able to sign builds to make them installable on [00:19] real devices. This is an illustration of what Apple code signing looks like and all the different bits that need to be configured on your Apple developer account. Each app needs to have a unique app identifier like the one we configured in a previous lesson. There are 3 kind of app builds that you can create with Apple. A [00:39] development build is a local debug build that allows you to install the app on your physical device via Xcode. For our purposes, we can ignore this option because you cannot create this type of build with EAS. Distribution build or production build is the build that you submit to test flight and into app store for your actual end [00:59] users to download. To sign a distribution build, you need a distribution signing certificate. You usually only have one on your account and you use the same certificate for all the app bills on your account. You also need a distribution provisioning profile. A provisioning profile is tied to the app ID, [01:19] and it is basically a declaration of what kind of Apple services your app is allowed to use. But in order to create a development build on our device, we will need the 3rd type of build, which is the preview or internal build. For this, we will need the distribution signing certificate. So this will be the same one used for [01:39] signing to production apps, but we'll need to use the ad hoc provisioning profile. With the ad hoc profile, you will need to pre register all the devices that should be able to install the build and then specifically enable them in the ad hoc provisioning profile. This can be quite tricky to set up but thankfully you can use the EIS CLI [01:59] to create all of these for your project in seconds. Open your terminal and type in EIS device create. The devices you add will be added to your Apple developer account and also saved on your expert account. So we need to use the same expert account we want to use to build the project. You'll now get prompted to log in with your Apple [02:19] developer account. There's a couple ways that you can register new devices. The simplest option is to use the website. It will generate a registration URL which you can open on the device to automatically register it. The developer portal option is for when you already have some devices registered on the Apple developer portal, [02:38] but you've never used them on EAS so they need to be imported. I'm going to use the input option. Here, we'll need to type in the UDID of your device. In order to find the UDID of your own phone, connect to your Mac and open finder then select your phone under locations. Here at the top under your phone's [02:58] name, you'll see some details about your phone. Click on this section and you will switch to a view that shows the serial and the UDID. Here you can right click to copy the UDID. So I'm going to choose input and input the UDID of the device I want to add and also give the device a [03:18] name. I'm going to call this Caddy's iPhone 15. You also need to choose what type of device it is. In our case, it's an iPhone. And we're just going to confirm we're happy to register this with the account. You can use the CLI to register multiple devices at the same time, but I'm going to just leave the one. Now at [03:37] this point, this device is registered on EAS, but not yet on the Apple developer profile. Next up, we want to create our ad hoc provisioning profile and our distribution certificate. We'll go to the terminal again and type in EAS credentials in our project directory. We'll choose iOS, [03:58] and let's choose development. If you're prompted to log in to your Apple account, let's choose build credentials. And from here, we can choose the all option. Set up all the required credentials to build your project. We'll get asked if you wanna create a new Apple distribution certificate, which is [04:18] this one. And we need it to create both our preview and distribution builds. So yes. Here, you'll actually see a list of all the devices you have registered on your account. You can use the arrow keys to select or deselect them. Bear in mind that the build you create can only be installed on devices that are [04:38] selected here. When you're done updating, press enter. And here you see the configure command has created our bundle identifier, our ad hoc provisioning profile, and our distribution certificate. If at this point you realize you need to add or remove devices from your provisioning profile, you can run EAS credentials again. We'll [04:58] choose iOS development. Log in to our account. Now we can choose to manage build credentials. Select all. And at this point, if there are any devices on your Apple account that aren't included in your ad hoc provisioning profile, you'll actually get prompted here whether you [05:18] like to choose the devices again. So I'm going to choose yes and add the remaining devices to the profile. Now if you open your Apple developer account and go to certificates, you can actually see the certificates that have been automatically created for you. So this here is the distribution certificate. That's this one [05:37] from our diagram. On the profiles, we have our ad hoc provisioning profile. So that is this one here. Actually if we open up this provisioning profile and we choose edit, you can actually see here the 3 devices I've explicitly allowed to be installed using this profile. [05:58] Also if we go under identifiers we will see the app identifier that was registered. One thing to note is that app capabilities such as push notifications, Apple Pay, etcetera are tied to your app ID. And when you add new capabilities to your app, they will need to be enabled from your app [06:18] ID and your provisioning profiles need to be regenerated. If you're using EAS, you don't really have to worry about this at all because EAS will keep these certificates up to date as you're building. But it's good to know what's going on under the hood.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!