44

In official documentation you can find the info:

Each push notification includes a payload. The payload contains information about how the system should alert the user as well as any custom data you provide. The maximum size allowed for a notification payload is 256 bytes; Apple Push Notification Service refuses any notification that exceeds this limit.

However in WWDC 14 we can see this screenshot:

enter image description here

I wonder if there is any official Apple statement about the size limit of push notification. I tested it and larger that 256 bytes works, but documentation said it shouldn't. Can someone confirm or deny the size of remote notifications?

Mohsin Khubaib Ahmed
  • 1,008
  • 16
  • 32
Jakub
  • 13,712
  • 17
  • 82
  • 139
  • From my own testing, it fits about 3-4 lines of text that you see on the alert popup screen. Each line has about a few words. I tend to think it resembles the amount you can write inside a Tweet, maybe a little bit lesser. I don't know about refusing the notification but I do know that if I put more text than 3 - 4 lines, they get truncated and not shown. – Zhang Oct 07 '14 at 10:26
  • It looks like Apple haven't updated their APNS docs yet. I couldn't find any official Apple doc that mentions the increase in payload size. – Eran Oct 07 '14 at 10:29
  • 2
    256 bytes for iOS7- and 2KB for iOS8+. Fore HTTP/2 its 4KB. Read more : http://www.jeenalinfotech.com/blogs/ios/what-is-the-maximum-size-of-apple-push-notification/ – MilanPanchal Apr 23 '16 at 09:48
  • @Zhang notifications can also be used to send *data* that is *not shown to the user*; hence the interest in knowing how large the payload can be. – ToolmakerSteve Feb 15 '17 at 00:52
  • I'm using VOIP and alert object size still truncate nearly around ~1KB. How max limit 5KB can be used in case of VOIP. Any suggestion ? – CoDe Mar 28 '17 at 11:51

5 Answers5

74

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)

Utsav Dusad
  • 2,139
  • 4
  • 31
  • 52
Xavier Maroñas
  • 3,124
  • 1
  • 14
  • 7
  • 1
    I want to mention that in contrast to the docs the 256 byte limit does not seem to apply to iOS 7. People tested and confirmed that their iOS 7 devices happily receive messages > 256 bytes. https://github.com/djacobs/PyAPNs/pull/79#issuecomment-51021572 – Lysann Schlegel Mar 10 '15 at 07:22
  • So Is it 2000 bytes or 2048 bytes ? – user1227928 Jun 29 '15 at 11:22
  • 1
    @user1227928 clearly says 2 kilo**bytes**, so your answer is 2000 bytes. A **kibibit** `KiB` (https://en.wikipedia.org/wiki/Kibibit) is 1024 bytes. But anyway, we all know Apple messes with these definitions (they probably use kilobytes as 1024 in software terms, but on device storage size they use 1000). – Alejandro Iván Nov 19 '15 at 17:01
  • Updated documentation: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH107-SW1 – Claus Jørgensen Feb 12 '16 at 02:17
  • @user1227928 The correct answer is 2048 bytes, not 2000 bytes, per the [docs](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html). – Brad Koch Jun 16 '16 at 16:18
  • This explanation is now a bit dated; the documentation has [moved](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html) and the new answer is either 2048 bytes via the binary interface or 4096 bytes via the HTTP/2 API. – Brad Koch Jun 16 '16 at 16:21
  • 2KB means 2048 bytes – Ganesh Aug 31 '16 at 02:06
  • 3
    @Ganesh - Actually, the point that was originally made by Alejandro, is that, by international standard (see his wiki link), `2KiB` means 2048 bytes, and `2KB` means 2000 bytes. However, in practice, `KB` has been used so commonly, for so long in computer software, to mean 1024, that it is not safe to assume either way. I myself don't abide by that standard, hard to break a habit of many decades, so I can't complain ;) – ToolmakerSteve Feb 15 '17 at 01:00
32

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/

Rajan Maheshwari
  • 14,465
  • 6
  • 64
  • 98
  • this is not true yet, they will add those things in 2016, as far as I know, there is no date – jcesarmobile Nov 17 '15 at 12:47
  • 1
    http/2 apns is officially supported. https://developer.apple.com/news/?id=12172015b – infiniteloop Feb 01 '16 at 11:33
  • Hi, I'm using VOIP but it still truncate alter object size to 512 byte only. How that make sense when Apple Document say it's increase to 5KB for VOIP. Any suggestion ? – CoDe Mar 28 '17 at 10:38
3

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.

Nicholas Smith
  • 11,642
  • 6
  • 37
  • 55
2
  • 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

Anand Kore
  • 1,300
  • 1
  • 15
  • 33
1

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.

Brad Koch
  • 19,267
  • 19
  • 110
  • 137