Every iOS app to be deployed to the App Store must first be identified by Apple. In this post will be shown how to generate those files so later on they can be used for the app deployment to the Store.
Navigate on https://developer.apple.com/account/resources/certificates/list. There are three important sections here that needs to be defined.
- Identifiers
- Certificates
- Profiles
Identifiers
In this section we can register an unique identifier for our iOS app that will represent the app on App Store. There are no two applications on the App Store with the same identifier. They are usually created as com.yourbrandname.ios. This one must be the same as the string form CFBundleIdentifier key in the iOS project inside the info.plist file.
- Choose Identifiers from the menu
- Click on the plus icon next to Identifiers and select App IDs for registering individual app for App Store than continue
- From the select type select App and continue
- In the Bundle Id choose Explicit and type your Bundle Id e.g. com.yourbrandname.ios and in the description type something recognisable for example “You App Name Bundle Identifier”, continue
- Review and Register
- The identifier will be created in the identifiers
Certificates
Certificates are used to sign your app. That helps Apple to identify our organization when submitting to App Store. Certificates includes private and public key. The certificate represents the public key and from that you can export the private key. The Apple does not keep information about the private key. .p12 file that will be exported in the next steps stores certificate together with the private key that corresponds to this certificate.
Create certificate signing request
The following six steps are taken directly form the apple documentation https://help.apple.com/developer-account/#/devbfa00fef7
- Launch Keychain Access located in /Applications/Utilities
- Choose Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.
- In the Certificate Assistant dialog, enter an email address in the User Email Address field.
- In the Common Name field, enter a name for the key (for example, Gita Kumar Dev Key).
- Leave the CA Email Address field empty.
- Choose “Saved to disk”, and click Continue.
Create certificate
- Navigate back to the Developer Apple site
- Choose Certificates from the menu
- Click on the plus button next to Certificates and select Apple Distribution than continue
- Choose the created file form the Desktop (the one in the Create certificate signing request section)
- Click continue
- The certificate will be created for you click on download and download it locally
Generate the .p12 file
- Once the file is downloaded locally double click on the certificate
- Certificate will be automatically added in your Keychain Access
- If you have multiple certificates from the same account and you are not sure what is your new created certificate in the Keychain Access form the menu choose Keychain Access > Certificate Assistant > Evaluate Certificate and select the downloaded certificate(.cer) remember the Id
- Go back in the Keychain and choose My certificates.
- Find the certificate with the same ID and click on the arrow
- The file with key image will appear, right click on it and click Export “…”
- Add meaningful name of the p12 file than save
- Add password and store it somewhere secure
- The .p12 file will be downloaded in the disc
Provisioning Profiles
Provisioning profiles are used to confirm if the app can be installed in the particular Apple device. The provisioning profile contains information about the signing which means it first must be approved by Apple and the application identity
- Choose profiles from the menu
- Click on the plus button near the Profiles and from Distribution select App Store than continue
- Choose App Id created in Identifiers and Continue
- Select the certificate created in Certificates and continue
- Add meaningful name for Provisioning Profile and Generate
- Download and double click if you want to export it in your Keychain Access
Register an App
Navigate to https://appstoreconnect.apple.com/apps and click on the plus button near Apps header. New app form will open
- Choose iOS or if you support any other platforms
- In the name add name for your app
- Choose primary language in the primary language field
- In the bundle id choose the bundle id created in the Identifier in the section one
- For SKU you should add some unique ID for your app that is not visible for the App Store since bundle id is unique I suggest adding the bundle id as SKU
- In limited access choose who you want to give access to.
- Click create and the app will be created for you
Following these steps you have everything you need for the app deployment to Test Flight/App Store.
Note: This files are used for distributing the app not for development.
What are you going to use is the Provisioning Profile file and the .p12 file with its password.