APN (Apple Push Notification) payload size limit

冷暖自知 提交于 2019-11-27 11:20:16
Xavier Maroñas

Apple has already updated the documentation. The 2KB for the maximum payload size is just for devices running iOS 8. The official doc says:

In iOS 8 and later, the maximum size allowed for a notification payload is 2 kilobytes; Apple Push Notification service refuses any notification that exceeds this limit. (Prior to iOS 8 and in OS X, the maximum payload size is 256 bytes.)


As per the updated Apple docs the size is 4KB.

  • For regular remote notifications, the maximum size is 4KB (4096 bytes)
  • For Voice over Internet Protocol (VoIP) notifications, the maximum size is 5KB (5120 bytes) NOTE

If you are using the legacy APNs binary interface to send notifications instead of an HTTP/2 request, the maximum payload size is 2KB (2048 bytes)

For iOS 9 there are some changes:

Introduction of HTTP/2
Payload increased to 4KB

4 KB limit apply to all versions of iOS and OS 10

Check this official link

  • For regular remote notifications, the maximum size is 4KB (4096 bytes)

  • For Voice over Internet Protocol (VoIP) notifications, the maximum size is 5KB (5120 bytes)

  • If you are using the legacy APNs binary interface to send notifications instead of an HTTP/2 request, the maximum payload size is 2KB (2048 bytes)

Check this video link for more details regarding the features of HTTP/2
https://developer.apple.com/videos/play/wwdc2015-720/

According to the testing from the node-apn project the size was expanded from 256 to 2KB over the beta period, I think it's likely Apple hasn't updated their documentation to reflect this change. The discussion on the node-apn project.

Edit: Urban Airship also updated their backend for 2KB as well.

  • For regular remote notifications, the maximum size is 4KB (4096 bytes)
  • For Voice over Internet Protocol (VoIP) notifications, the maximum size is 5KB (5120 bytes)

NOTE

If you are using the legacy APNs binary interface to send notifications instead of an HTTP/2 request, the maximum payload size is 2KB (2048 bytes)

Apple Docs : https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW1

Per the most recent official documentation, the payload limit is 4096 bytes or 2048 bytes for regular notifications, and 5120 bytes for VoIP notifications:

The maximum size of the payload depends on the notification you are sending:

  • For regular remote notifications, the maximum size is 4KB (4096 bytes)
  • For Voice over Internet Protocol (VoIP) notifications, the maximum size is 5KB (5120 bytes)

Note: If you are using the legacy APNs binary interface to send notifications instead of an HTTP/2 request, the maximum payload size is 2KB (2048 bytes).

Prior to iOS 8, the limit was 256 bytes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!