At first glance, configuring your iOS application to properly interact with APNs may seem a bit complicated, but once you learn the ropes it gets fast and easy. Take a minute to read the instructions below.
Our Developer account holders can use the iOS Autoconfiguration tool that greatly simplifies and speeds up the whole process - jump to step 5.2!
For testing purposes we strongly recommend creating two versions of the app in Pushwoosh — one for production, and the other for development with corresponding private keys. Otherwise, there is a big chance to lose live subscribers by accidentally invalidating device tokens with a push sent to a wrong gateway.
First, generate a certificate request file for requesting a development SSL certificate later on.
1.1. Launch Keychain Access on your Mac
1.2. Select Keychain Access >> Certificate Assistant >> Request a Certificate From a Certificate Authority (Figure 1):
Figure 1. Generating a certificate request
1.3. Enter the required information and choose Saved to disk. Click Continue (see Figure 2):
Figure 2. Saving the certificate request to disk
1.4. Click Save to save the certificate request using the suggested name. (Figure 3) >> Done on the next screen.
Figure 3. Naming the certificate request
If you have an App ID ready, skip to step 3. Configuring an App ID for Push Notification
Each iOS application using the APNs must have a unique application ID. In this step, you will learn how to create App IDs for push notifications.
2.1. Sign in to iOS Developer Center at: https://developer.apple.com/membercenter/. Click Certificates, Identifiers and Profiles on the right (Figure 4).
Figure 4. Launching the iOS Provisioning Portal
2.2. You will see the welcome page (Figure 5). In iOS Apps choose Identifiers.
Figure 5. Welcome screen of the iOS Provisioning Portal
2.3. Click App IDs on the left and then click New App ID (Figure 6).
Figure 6. Adding the new App ID
2.4. Register a new App ID. Enter your App ID Description (Ex: “PushAppID”), and select an App ID Prefix. In App ID Suffix choose Explicit App ID, and provide a correct Bundle Identifier in the form com.company.application (i.e.: com.arellomobile.MyPushApp). Check Push Notifications from the list of App Services and click Continue (Figure 7), then Submit, and then Done.
Figure 7. Creating a new App ID
2.5. You should now see the new App ID (together with those created earlier). Click Edit to configure Push Notifications for your App ID (Figure 8).
Figure 8. Viewing the newly created App ID
Once an App ID is created, you need to configure it for push notifications.
3.1. To configure an App ID, click Create Certificate on the right (Figure 9).
Figure 9. Creating the Development SSL Certificate
3.2. You will now see the Apple Push Notification service SSL Certificate Assistant screen. Click Continue (Figure 10).
Figure 10. The Apple Push Notification service SSL Certificate Assistant screen
3.3. Click Choose File to locate the Certificate Request file that you have saved earlier. Click Generate (Figure 11).
Figure 11. Generating the SSL certificate
3.4. Your SSL Certificate will now be generated. Click Continue, and then click Download to download SSL Certificate to your drive. Click Done (Figure 12).
Figure 12. Downloading Certificate
3.5. Download and double-click the certificate to install it in the Keychain Access application (Figure 13). This is the SSL certificate Pushwoosh uses to contact the APNs and send push notifications to your applications. Now you need to export the certificate.
Figure 13. Installing the generated certificate into the Keychain Access application
4.1. Open Keychain Access and select the ‘Keys’ category.
Click the private key associated with your iOS Push Certificate and click ‘Export Items’ in the menu (Figure 14).
Please note that this is not a private key for your iOS Development certificate.
You will be prompted to create a password. You will need to enter the same password on Pushwoosh configuration page.
This is the file you need to upload to Pushwoosh. You will need to enter the same password to create the Private Key (see right above).
Figure 14. Exporting Key file
4.2. To install the Certificate and Private Key for the application log in to your Control Panel, go to My applications, select your application, and open Configure page in the left menu (Figure 15).
Figure 15. App Configuration Page
Select iOS platform by clicking Configure button. Push notifications can be configured through Control Panel manually or automatically.
5.1. For Manual Configuration upload the private key to Pushwoosh, enter your Private key password, and select your framework, then click Save (Figure 16).
Figure 16. Uploading Certificate and Private Key files (Manual Configuration)
For Auto Configuration select “Auto” tab and follow these next steps:
- 1) Enter your Apple ID and Password
- 2) Select your Developer team
- 3) Select your App ID
- 4) Select the gateway you want to configure: Sandbox for developer app builds, Production (aka Distribution) gateway for AdHoc and AppStore builds
During Auto Configuration a new APNs certificate for the specified Apple App ID is generated. Therefore any existing APNs certificates for this Apple App ID will be revoked.