Enabling Push Notifications for iOS Apps
Push notifications on any platform are a complicated multistep process, and so is setting them up. There's documentation at Supersonic, but it mostly points to the steps you need to do for iOS and Android. Because push notifications are a potential source of really annoying spam, there are some deliberate hurdles in enabling push notification, to make sure they're coming from a trusted app. As usual, the steps for iOS are more complicated than for Android. For some tutorial background, see Demystifying iOS Certificates and Provisioning Files and Ray Wenderlich's tutorial.
The steps become yet more complicated when working with the free Northwestern team developer licenses, because many of the setup steps can only be done by an authorized team admin, such as myself.
As best I understand it, with advice from NUIT, this is what you need to do to enable push notifications for your app, for ad hoc test distribution.
Generate a CSR Certificate Request file
Delegate one person on your team to be the certificate requester. It should be someone who will be available, with their machine, until the end of the project. Then:
- Launch Keychain Access, in Applications | Utilities subfolder.
- From the Keychain Access menu bar at the top of your screen, select Keychain Access | Certificate Assistant | Request a Certificate from a Certificate Authority.
- Enter the following in the Certificate Information window:
- User Email Address: enter your email address associated with your Apple Developer ID.
- Common Name: create a name for your private key, e.g., John Doe Dev Key.
- CA Email Address: leave blank.
- Request is: select Saved to disk.
- Click Continue to complete the CSR generating process.
A CSR will be generated and a private key will be stored in the KeyChain of the machine.
Send Me Your App Provisioning Data
Send me the following information in an email with subject line CS 394 [your team name] Push Information:
-
The bundle ID for your app, as specified in Xcode.
This should not be the default Wildcard ID, but something like edu.northwestern.CS394.your-app-name. - A short text description of the app, e.g., "workit app from team mauve" -- this doesn’t need to match anything in Xcode
- the CSR certificate request file just generated
- The Mac developers on your team, from the list of registered team members
- The devices that will be installing the app, from the list of registered devices
If there are any new devices to add, you need to send me a description and device ID so I can add them.
Wait for the Certificate Material
I will generate the provisioning profile and push notifications certificate with the information you've given me. I will send an email with the Push Notifications Certificate and you can download the Provisioning Profile from Apple.
Install the Provision Profile
Every developer should
- Download the provisioning profile from the Profiles page.
- Double-click the profile to import it into Xcode.
- Verify you can build and test your app in Xcode.
Make sure the bundle ID for the app in Xcode matches the one you sent me.
Install a Client SSL Signing Identity on Your Push Notification Server
To actually send push notifications, you need to use a push notification server. You can run one on a development machine, or use a service, such as the ones provided by Parse and others. Depending on which server you use, you need to give it either a .pem (Privacy Enhanced Mail) or .p12 (Personal Information Exchange) file, generated as follows.
On the machine that was used to create the CSR file, double-click the “Push Notifications Certificate” file I sent you, to add it to that machine's Keychain, then:
- Launch Keychain Access.
- Click on My Certificates under Category.
- Find the certificate.
- Click the twist-down triangle to see the certificate and private key.
- Select both and choose File | Export Items.
- From the File Format pop-up menu, choose a file format that your server accepts.
- Enter a filename in Save As, and click Save.
Copy or upload the exported file to your push notification server.