This time I will clarify all the pieces in regards to the mysterious iOS provisioning course of and the construction of a provisioning profile.
Bitrise
What’s provisioning?
iOS is a really safe working system. You possibly can solely set up apps in your system which have been authorised by Apple so your utility must be digitally signed earlier than it will get printed to the App Retailer. The signed binary helps Apple make sure the content material is coming from the precise developer (staff), so it isn’t compromised or altered by a third-party hacker. Unsigned apps can’t be printed on the App Retailer, so this course of permits Apple to be the gatekeeper for his or her working system. Principally, they will merely disable developer accounts or revoke certificates if they do not comply with the principles. If that occurs, you will not have the ability to set up apps from that developer anymore.
Nonetheless, when you develop an utility you may need to take a look at it on an actual system earlier than the submission course of. That’s what provisioning course of is for: you may signal your utility with a particular file known as provisioning profile. This file is a group of digital entities that connects bodily units to licensed developer groups. You possibly can generate a provisioning profile to your utility through the use of the Apple developer portal. 👍
Now that what provisioning is and why it’s so necessary, let’s take a deeper take a look at on provisioning profiles and certificates.
What sort of provisioning profiles are there?
There are 4 varieties of provisioning profiles:
- improvement
- distribution
- ad-hoc
- in-house
The improvement profile provides you the power to check your apps in your bodily units. It accommodates the distinctive system identifier for each single take a look at system. You possibly can solely run your app on the units which can be included within the improvement profile.
The distribution profile has no such limitation, as a result of it is used to distribute your app by the App Retailer. If you wish to submit your app for approval, it’s important to signal it with a distribution profile. If Apple approves it, your app could be printed to the shop, and this implies it may be put in by anybody. 😊
You may also create an ad-hoc profile which is mainly a distribution profile with system identifiers. Apps signed with the ad-hoc distribution provisioning profile could be put in on a restricted variety of designated units by web sites, mails or OTA. It is good for public beta testers, QA groups or consumer demos.
The in-house profile is just out there for enterprise builders, it may be used for inside distribution for non-registered units too. This implies that you’re not restricted to system identifiers, but it surely should not be used for the general public (solely to your firm or the workers of a selected firm). Every profile kind should be registered with a certificates they usually each are required through the code signing course of. You possibly can solely set up your utility after the binary is signed correctly. If the certificates is expired or you do not have the corresponding personal key you will not have the ability to signal the app. Additionally if the provisioning profile is invalid, or if it would not comprise your system identifier (see under) you will not have the ability to launch your app. 📱
The anatomy of a provisioning profile
Each single provisioning profile accommodates the next issues:
- app identifier
- staff
- capabilities
- entitlements
- certificates
- distinctive system identifiers (non-obligatory)
An app identifier could be registered by the developer portal by offering a bundle identifier search string. It may be an specific one or a wildcard app id. Apple goes to create it out of your staff id and the bundle id. It is used to uniquely determine your app through the provisioning course of.
A bundle id is only a distinctive identifier beneath your developer account, however the app identifier is a broadly used distinctive id for the whole App Retailer ecosystem. Normally, it is best to use a reverse area notation while you create a bundle id.
The staff part is simply fundamental details about your developer staff. If you’re a part of a number of developer groups, the construct system has to search out the precise one to your provisioning profile through the code signing course of.
Capabilities are (cloud-based) companies and options. You possibly can allow them from Xcode. A few of them should be configured contained in the developer portal beneath the App IDs part. For instance, the Push notifications functionality requires extra certificates and entitlements should be added to your utility.
Entitlements are easy configurations for accessing numerous companies, reminiscent of iCloud storage, Push Notifications, Apple Pay and so forth. It is a plist file inside your utility bundle. You do not actually have to fret about it an excessive amount of, Xcode can usually maintain managing entitlements.
Certificates are used through the construct course of to signal the app. Each certificates has an related personal key element. So as to code signal the binary, you will want the personal key in your native keychain. Certificates can expire too, so it’s important to renew them yearly otherwise you will not have the ability to signal apps anymore. 🙅♂️
Distinctive system identifiers could be embedded right into a provisioning profile. If you’re making an attempt to run a take a look at model of your app on an actual system you will have to register your take a look at units’ UUID. You are able to do it manually contained in the developer portal or when you want Xcode it could actually additionally do the job for you. It would not matter which technique you select, however when you add a brand new system to the developer portal, you additionally must re-generate the provisioning profile.
Expiration and invalidation
Each provisioning profiles and certificates do expire. If a profile expires, the app will fail to launch. It’s important to renew the profile, rebuild, resign and reinstall the applying on the specified system if you would like to proceed to make use of it.
Except for an in-house distribution profile, all the profiles expire in a 12 months from the date of the creation of the profile. Which means that the profiles should be re-generated yearly to maintain distributing apps to units or the App Retailer. ⌛️
Advert-hoc profiles have longer expiry dates. Additionally, in case your utility is submitted to the App Retailer, don’t fret an excessive amount of, you may set up it any time. Distribution profiles do expire, however that solely impacts your code signing workflow.
Nonetheless, there may be one factor that may occur along with your app within the App Retailer. In the event you break a rule Apple can revoke your signing certificates so you will not have the ability to submit apps anymore. They’ll additionally take away your utility from the shop.
If a certificates expires or will get revoked, the related profiles will likely be invalid too. You possibly can at all times test the standing of your provisioning profile contained in the developer portal.
What may go fallacious?
These days, you do not have to create provisioning profiles by your self: you simply want to attach your developer account beneath Xcode’s preferences. If you’re prepared, you may safely allow the computerized code signing characteristic beneath the goal, so Xcode can maintain the remaining, however it is best to notice that typically issues can get tousled. 🤪
You possibly can at all times use the developer portal to double test all the pieces. Here’s a fast record of the commonest issues that may happen.
Examine if
- you could have a sound certificates (keychain + developer portal)
- the certificates has an related personal key (keychain)
- an App ID to your bundle id exists (developer portal)
- all of the capabilities are arrange and able to use (Xcode + developer portal)
- the entitlements are prepared to make use of (Xcode)
- the bodily take a look at system id is registered (developer portal)
- the provisioning profile is legitimate (developer portal)
- the provisioning profile accommodates the certificates and the system ids
How do you test the final one? Properly, let me clarify this briefly.
Checking what’s inside a provisioning profile
The provisioning profiles are robotically downloaded by Xcode and saved beneath the ~/Library/MobileDevice/Provisioning Profiles
listing. In the event you navigate to this folder you will see a bunch of randomly named information. That ain’t gonna assist an excessive amount of. 😅
There are two superb QuickLook plugins, which can allow you to examine the whole content material of a provisioning profile immediately from Finder. I actually love this method, as a result of these plugins give me much more particulars than Xcode itself.
Abstract
Let me sum up all the pieces yet another time actual fast. ⚡️
If you wish to run an utility on a bodily system it’s important to configure a sound provisioning profile. You possibly can get hold of a profile from the developer portal. That profile, in a while through the construct course of, will likely be embedded immediately into the app bundle, plus the app goes to be code signed through the use of your developer credentials.
In the event you attempt to launch the app on the system, first the provisioning profile goes to be checked and if it would not match the required standards your app will not run in any respect. If you’re fortunate sufficient and all the pieces was okay, your app will launch simply high quality.
This entire course of above known as provisioning. I hope you loved this text. Subsequent time I will write about code signing and the way to resolve code signing points. 😉