- Computers & Software»
- Computer Science & Programming»
- Computer Programming Tutorials
How to create .p12 APN Push Notifications certificates on iOS
If you want to use Push Notifications for your iOS apps but don't know how to configure your own server for them - which is a pretty difficult thing to do - you can use BaaS services like back4app.com or OneSignal.com. Those websites need .p12 APN certificates in order to handle push notifications from your code, so keep reading to see how to generate and export Development and Production APN Certificates.
First of all, you need to login into your account on the Apple Developer Portal and click on Certificates, Identifiers & Profiles.
Enter App IDs section and search for your Bundle Identifier. You don't have to type the whole bundle ID as it is, like com.domain.myappname, if you type only your app name you'll still find it. Let's pretend your Bundle Identifier is com.domain.mygreatapp, just type mygreatapp and you'll get it.
Once you've found your Bundle ID, click on it to expand it and scroll down to click on Edit.
Scroll down to the Push Notifications option and click on the first Create Certificate button, the one in the Development SSL Certificate box. Later you'll create the Production SSL Certificate certificate as well.
Before going on with the creation of your certificates, you must request a Certificate from an Authority. In order for you to do so you have to open Keychain Access app on your Mac and select Certificate Assistant -> Request a Certificate from a Certificate Authority.
Next you must type your email address - which should be your Apple ID - and select the Saved to disk option. Then click Continue.
Save the new generated "CertificateSigningRequest.certSigningRequest" file on your Desktop, you'll need it soon. then click Done.
You can now go back to your Developer page in your browser and click Continue.
In order to generate your Development APN Certificate you need to upload the CertificateSigningRequest.certSigningRequest file in the Apple's server, so click on Choose file.. and select CertificateSigningRequest.certSigningRequest.
Then click Continue to upload it.
On the next screen, click Download to download your Apple Development iOS Push Services certificate.Get it on your Desktop and then click on Add Another.
Repeat the steps mentioned above to generate a production APN Certificate this time, download it on your Desktop and click Done.
Then double click on both your .cer files to install them into your Keychain Access.
You're almost done, expand both rows in your Keychain Access in order to display another row with a small grey key.
Right click on the first one, select Export option and save it to your Desktop, name it as you wish, that will be your .p12 Development Certificate for Push Notifications.
NOTE: when a popup will ask you to add a Password, DO NOT do that, it's not needed
You're done, you've just created the necessary .p12 certificates needed for any BaaS services that provide Push Notifications support, such as back4app.com, OneSignal.com, etc.