2

Since iOS8 came up with interactive notification, is there any significant changes to make Payload to send push notification? If changes are there then how it will be handled in lower versions of iOS?

Augustine P A
  • 5,008
  • 3
  • 35
  • 39

1 Answers1

5

There is a small difference in payloads as given. However same interactive notification payload can be pushed to iOS7 or less, it will be shown as normal notification.

iOS8 Interactive Push Payload

{"aps":{"alert":"Hello Testing","badge":1,"sound":"default","category":"your_category_key"}}

"your_category_key" is nothing but the UIMutableUserNotificationCategory identifier.

Older Version less than iOS8 Payload

{"aps":{"alert":"Hello Testing","badge":1,"sound":"default"}}

And Apple has extended the payload size up to 2048 Bytes (2K). Previously it was 256 Bytes only.

Augustine P A
  • 5,008
  • 3
  • 35
  • 39
  • Can you please provide a reference to Apple documentation for the extended 2K payload size? – Muxa Oct 06 '14 at 21:55
  • I also didn't find any official documentation for this. But I tested the same with 2K (2048 Bytes) payload size and notification has been successfully delivered. – Augustine P A Oct 07 '14 at 04:38
  • the documentation can be found in the WWDC 2014 video on notifications. – hokkuk Oct 19 '14 at 23:35
  • Is there no way to have a unified Payload to iOS7 & iOS8, all the while knowing that we don't know the iOS version of the Push Receiver? – Yozef Nov 19 '14 at 14:52
  • @Yozef You can use payload with interactive notification for iOS8 & iOS7. When notification received, iOS8 will show interactive notification and iOS version less than iOS8 still show only the notification content. Here I explicitly given the payload examples only for better understanding. – Augustine P A Nov 20 '14 at 05:47
  • The local and remote notification programming guide says "In iOS 8, the previous size limit of 256 bytes for a push payload has been increased to 2 kilobytes.". – huggie Dec 03 '14 at 09:19
  • @AugustinePA Do you mean if I send `{"aps":{"alert":"Hello Testing","badge":1,"sound":"default","category":"your_category_key"}} `,will it work for both iOS7 and iOS8? And if so what will be the maximum size supported for iOS7, 256bytes or 2KB ? – atulkhatri Dec 24 '14 at 08:54
  • @Muxa, Yes, this is correct. **From doc**: `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.)` and [here's the updated doc link](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html). – Hemang Jan 08 '15 at 12:35
  • @Muxa, This may come a little bit late, but it may help others: The reference you were looking for can be found in https://developer.apple.com/library/prerelease/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9 It's under the section "The notification payload" – tf.alves Mar 22 '15 at 16:44