For anybody who is currently using push notifications in their Apps, be aware that there are three big changes on their way later this year. Unlike many WWDC announcements, these changes affect every version of iOS and OS X, not just iOS 9 and OS X El Capitane.

There are three big changes to discuss:

  1. Push Notification Actions
  2. APNS Token Size
  3. Providers API

Let's go through each one by one.

Text Input Action

Last year, Apple provided us with push notification actions, which give the user a fast way to handle an incoming notification simply by tugging down at the banner and selecting an option. Up until this point, the Messages.app had access to an additional service, which 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, as 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.

let commentAction = UIMutableUserNotificationAction()
commentAction.title = "Comment"
commentAction.identifier = "comment"
commentAction.activationMode = .Background
commentAction.requiresAuthentication = false
commentAction.behavior = .TextInput

watchOS 2 handles this in the correct way by popping up the input dialogue that 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. However, in 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).

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 that 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.

Given that 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.

Possible responses include:

200 OK
400 BAD REQUEST {'reason' : ...}
410 GONE // If device token is no longer active.

Carrot 2: One Certificate

To send pushes, we've had to ensure that we have the correct development and production certificates for each type of push we wanted (e.g. App, VOIP). However, 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.