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:
- Push notification actions
- APNS token size
- 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 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.
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).
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
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.
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: Apple, Apple Watch, iOS9, Push notifications, WWDC
This post was written by Andy Drizen