Step to compile an iOS app
Create the items related to the developer account with which you are going to publish
You have to create a CSR file and an iOS Distribution certificate. And you will be able to use these items for all of the next apps you will have to publish under this developer account –> keep them preciously once created.
The CSR file:
It must be created from the keychain access tool of your Mac. Open it from Applications > Utilities > Keychain Access:
From the menu select “Keychain access” > “Certificate assistant” > “Request a certificate from a certificate authority”:
In the window that opens, enter the email of the developer account (or any other email address, it doesn’t have any impact), and enter the name of your developer account, and select “save to disk”:
Save this CSR to your disk, in a folder related to the certificates of your developer account.
Close the window.
The iOS Distribution certificate:
– Connect at https://developer.apple.com/membercenter/index.action with the developer account
– Click on “Certificates, Identifiers & Profiles” and then on “Certificates” again
– Click on “Production” which in the main “Certificates” menu in the menu on the left:
– Then click on “+” from the upper right
– Choose “App Store and Ad Hoc” and click on “continue”:
– Click on “continue” again
– Sign your iOS Distribution certificate with the CSR file you have created before
– Download the ios_distribution certificate that has been created.
Create the items related to the app you are going to publish
The APS Production certificate:
Thanks to this certificate you will be able to add push notifications, in-app purchase, and other services to your app. In our case, only the push notification service is interesting.
– Click on “App IDs” from the “Identifiers” menu on the left:
– click on “+” from the upper right
– enter your app name, and the bundle id of the app:
– Go below and select “Push Notifications” in the list of “App Services”:
– Click on “continue”
– Click on “continue”, click on “submit”, click on “done”
– Then in the list, find the app id you have just created and click on it
– Click “edit”
– Go at the bottom and in the “Production SSL Certificate” section click on “Create Certificate”
– Click on “continue”
– Click on “choose file” and upload the CSR file you have created for before for this developer account (the same CSR you have used to create the iOS distribution certificate for this developer account)
– Download the aps_production certificate that has just been created. Store this certificate in a folder related to this app on your Mac.
– Click on “done”
The Provisioning Profile:
– click on “distribution” from “Provisioning profile” on the left menu:
– Click on “+” from the upper right
– Choose “App Store” under “Distribution”:
– Select the app ID of your app, and click on “continue”
– Select the iOS Distribution certificate associated to the CSR you have used to sign the aps_production you have created just before (it is very important to use the iOS Distribution which has been created with the CSR used to sign the aps_production.cer of this app. Don’t forget it, and don’t forget that in case you create a new aps_production.cer for this app with another CSR you will have to create a new provisionning profile too with the iOS Distribution certificate made with this CSR, and then to publish an update of your app on the App Store)
– Click on “continue”
– Download the provisionning profile that has just been created. Store this certificate in the folder related to this app on your Mac, and which contains the aps_production certificate created just before.
Compiling the app
– Download your iOS source code
– Unzip the folder and open the xcode project in Xcode
- Compile and archive your project
Creating the .pem certificate:
– Go in the keychain access on your Mac
– from the left menu, select “Certificates”
– in the search bar at the upper right, enter the bundle ID of your app
– click on the arrow on the left of your “Apple Production IOS Push Service” certificate, a private key must be attached under it
– Select the private key and the certificate
– Right-click on them
– Choose export
– Choose your desktop as the destination (it can be another location but you will have to adjust the code we will give you after)
– Choose a password of your own
– Open the Terminal console of your Mac (From Applications > Utilities > Terminal)
– In the Terminal, be sure to be located on your desktop (you must have “Desktop” displayed and then your username)
– Enter this command:
“openssl pkcs12 -in Certificates.p12 -out certificat.pem -nodes -clcerts”
(If the terminal answers that there is no file named “Certificates.p12”, go on your desktop and check what is the name of this certificate .p12, and enter this name rather than Certificates.p12 in the command line)
– Enter the password you have used just before to export your certificate on your desktop
– On your desktop you have now two certificates: a Certificates.p12 and a certificat.pem.
– Move these files to the folder of your app on your Mac (with the provisionning profile and the aps_production.cer)
– Upload this certificat.pem on the app sheet in your backoffice
– You’re done!