Sending Push Notifications

Now that CocoaServer has the device token of its client application, it can send a notification package to Apple’s push notification server. The first step in this process is connecting to the notification server with NSStream. Once we have a connection, we’ll pack up and send the notification data that will eventually be sent to the device.

Connecting to Apple’s server with NSStream

Apple requires that the data sent to its server from the provider be encrypted. This is where the SSL certificate you downloaded comes into play – the provider must encrypt its outgoing data with this certificate.

Locate the aps_developer_identity.cer file that you downloaded earlier. Double-click on it to add it to your Login keychain. ...

Get iOS Programming: The Big Nerd Ranch Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.