June 25, 2015

WWDC 2015 – Big changes to Apple push notifications

Written by

Andy Drizen was part of the Odecee contingent at WWDC 2015 in San Fransisco. Here, he looks at a few big changes that will impact app developers…

Anyone currently using push notifications in their apps should be aware of the big changes announced at this year’s WWDC. Unlike many WWDC announcements, these changes affect every version of iOS and OS X, not just the new iOS 9 and OS X El Capitane.

There are three big areas of change to discuss:

  1. Push notification actions
  2. APNS token size
  3. Providers API

Let’s go through each one-by-one.

Text input action

textInputPhone
Last year, Apple provided us with push notification actions, which give the user a fast way to handle an incoming notification by simply tugging down at the banner and selecting an option. Until now, the Messages.app had access to an additional service that allows the user to respond to an incoming notification with arbitrary text input; this exiled all other messaging apps to the land of pre-canned and emoji responses only. Thankfully, with the introduction of iOS 9, any app can include one or more `TextInput` actions for their own push notifications. To include it, the code is essentially the same as it was for other actions, with the exception of the new `.TextInput` behaviour.

wwdc-textinput
 
watchOS 2 handles this in the correct way by popping up the input dialogue we’ve seen in the watch’s Messages app.

Note that this is an iOS 9 feature only – if your App supports iOS 8, you’ll need to check which version of the OS your app is running on, and only show text inputs for iOS 9 and above.

APNS token getting bigger

Up until this point, a device token (used to identify a particular iOS or Mac device for the purposes of sending push notifications) has been a 32-character hexadecimal string. At WWDC 2015 – buried in the middle of a history lesson about how to use APNS – Apple quietly announced that they are planning on lengthening their device tokens from 32 bytes to 100 bytes next year. It may seem like a boring change – but it’s something many of us will need to plan for by checking that our database schema will accommodate these larger tokens.

New providers API

Here’s the big one. In the past, the push notification workflow has been tedious with no request/response model. Every time you send a push notification, you must then poll the APNS Feedback service to check each device token is still accepting your pushes (shown below).
apnsOldFlow
 
Thankfully, this is soon to be a thing of the past – and not just for iOS 9 or OS X 10.11 either; the brand new API rolls out across every version of iOS and OS X later this year.

The new API is built on HTTP/2, which means it is a request/response model (finally!) and furthermore, multiplexed (so you may have multiple concurrent requests in the same connection) and binary, which is a lot more efficient.

Assuming your system is already set up, you may wonder why you should think about migrating to this new API. Firstly, it wouldn’t be uncharacteristic of Apple to merely shutdown the old API with little warning (a la TestFlight), but for now at least, Apple are leading with carrots rather than sticks:

Carrot 1: Feedback

Every time a request is made, the feedback comes back instantly, which means the Feedback service is essentially obsolete.
apnsFeedback
 
Possible responses include:
wwdc-big-changes
 
Carrot 2: One Certificate

To send pushes, we’ve had to ensure we have the correct development and production certificates for each type of push we wanted (e.g. App, VOIP). This was unwieldy and confusing. Thankfully, Apple have addressed this by only requiring one certificate with the new providers API.

Carrot 3: Payload Size

Finally, with the new provider API, the payload size has increase from 2KB to 4KB.

Summary

These great changes were announced towards the end of a fairly fluffy session, so they were easy to miss. However, these updates will be significant for your app, and planning for their integration may take time. If you want to watch the announcement, skip the first 10 minutes to get to Text Input, and then skip to 16:45 for the new providers API.

Tags: , , , ,

Categorised in: Digital, Mobile, News

This post was written by Andy Drizen