Sending Push Notifications to iOS 13 Devices with Amazon SNS
Note: This post was written by Alan Chuang, a Senior Product Manager on the AWS Messaging team.
On September 19, 2019, Apple released iOS 13. This update introduced changes to the Apple Push Notification service (APNs) that can impact your existing workloads. Amazon SNS has made some changes that ensure uninterrupted delivery of push notifications to iOS 13 devices.
iOS 13 introduced a new and required header called
apns-push-type. The value of this header informs APNs of the contents of your notification’s payload so that APNs can respond to the message appropriately. The possible values for this header are:
Apple’s documentation indicates that the value of this header “must accurately reflect the contents of your notification’s payload. If there is a mismatch, or if the header is missing on required systems, APNs may return an error, delay the delivery of the notification, or drop it altogether.”
We’ve made some changes to the Amazon SNS API that make it easier for developers to handle this breaking change. When you send push notifications of the
background type, Amazon SNS automatically sets the
apns-push-type header to the appropriate value for your message. For more information about creating an
alert type and a
background type notification, see Generating a Remote Notification and Pushing Background Updates to Your App on the Apple Developer website.
Because you might not have enough time to react to this breaking change, Amazon SNS provides two options:
- If you want to set the
apns-push-typeheader value yourself, or the contents of your notification’s payload require the header value to be set to
mdm, Amazon SNS lets you set the header value as a message attribute using the Amazon SNS Publish API action. For more information, see Specifying Custom APNs Header Values and Reserved Message Attributes for Mobile Push Notifications in the Amazon SNS Developer Guide.
- If you send push notifications as
backgroundtype, and if the contents of your notification’s payload follow the format described in the Apple Developer documentation, then Amazon SNS automatically sets the correct header value. To send a background notification, the format requires the
apsdictionary to have only the
content-availablefield set to 1. For more information about creating an
alerttype and a
backgroundtype notification, see Generating a Remote Notification and Pushing Background Updates to Your App on the Apple Developer website.
We hope these changes make it easier for you to send messages to your customers who use iOS 13. If you have questions about these changes, please post a message in the Amazon SNS Developer Forum or open an Amazon SNS case with AWS Support through the AWS Management Console.