Before you are able to use Push Notifications on your iOS Application, a few steps are required. This section of the tutorial gives a quick overview of what is needed!
First you need to submit a request for a new digital certificate, which is based on a public/private key. The Certificate itself is acting as the public key, and when you request it, a private key is added to your KeyChain tool. The Cerficate will be used later on, to request an SSL certificate for the Apple Push Network Service, which will allow the AeroGear Push Server to send notification messages to it. Now the actual CSR (Certificate Signing Request) is done using KeyChain Access tool found in Applications > Utilities folder on your Mac. Once opened, in the KeyChain Access menu, choose Certificate Assistant > Request a Certificate from a Certificate Authority:
Make sure that you have choosen to store the CSR on file, so we can upload it later in the provisioning portal when requesting the actual SSL cert. Going back to KeyChain Access you now see a new private key:
Now that the CSR is generated, go to the Provisioning Portal and log in with your Apple developer account. Now, click on the Identifiers link in order to create a new App ID (use the PLUS Icon on the right). In the formular give the App ID a descriptive name, like My first AeroGear Push App. Double check that the Push Notifications checkbox is selected:
Later in the same page you are asked for an Explicit App ID, since the generic Wildcard App ID does not work with Push Notifications. In the Bundle ID field enter YOUR bundle ID. This is similar to Java packages. In this example we choose org.aerogear.PushTest, however you must use your own ID. NOTE: The Bundle ID has to match the one from the actual iOS application that you are building later in this guide.
In the next screen confirm your new App ID, and double check that the Push Notifications option is enabled. Afterwards click the Submit button! Now you are Done. In the next screen, click on on the newly created App ID. After clicking on it, the following screen appears:
Click the Edit button and scroll down to the Push Notifications section. Here we are asked to generate a Development and a Production certificate that would be used by the UnifiedPush server when contacting the Apple Push Notification service to send messages. If you plan to distribute your app in the App Store, you are required to generate a Production certificate. In this guide we will generate both Certificates and register them with the UnifiedPush server.
Let’s start first by generating the Development Certificate. Click the Generate button on the Development SSL Certificate section:
Inside of the next Dialog you are asked to upload the Certificate Signing Request that we created earlier. Now perform an upload of the CSR and click the Generate button:
Finishing the upload dialog, you are coming back to the overview of the App ID.
Now click the Edit button again and scroll down to the Push Notifications section. Notice that the Development SSL Certificate section is filled with the required details.
Time now to create the Production certificate by following the same steps as previously, this time by clicking the Create Certificate button on the Production SSL Certificate section. Once you are done, you are back to the overview of the App ID.
Click the Edit button again and scroll down to the Push Notifications section. Now that we have both Certificates generated, time to download them locally to your computer.
The Development SSL Certificate file is being downloaded as aps_development.cer. Double click on it and it shows up in the KeyChain Access tool:
Now you have to export this certificate/private key pair to the .p12 (Personal Information Exchange). This file will be uploaded later on to the AeroGear Push Server enabling it to authorize itself for your development application on Apple Push Network Service and send messages to it.
When exporting the file, as your private key, you need to assign a passphrase for it. Make note on it, cause later when uploading it to the AeroGear Push Server you will need both the exported file and the passphrase.
Follow the same steps to download the Production SSL Certificate, the file is being downloaded as aps_production.cer. Double click to add in your KeyChain Access tool:
Now export it too as a .p12 (Personal Information Exchange). This file will be uploaded later on to the AeroGear Push Server enabling it to authorize itself for your production application on Apple Push Network Service and send messages to it. When exporting the file, as your private key, you need to assing a passphrase for it (this can be same or different with your passphrase for your development certificate).
Next, you need to create an Apple Provisioning Profile