`thread-id` field has no noticeable effect

Originator:jon
Number:rdar://29670386 Date Originated:2016-12-14
Status:Open Resolved:
Product:ct:iOS + SDK Product Version:iOS 10.1.1 (14B150)
Classification: Reproducible:Always
 
Area:
APNS (Notifications)

Summary:
The `thread-id` APNs payload field was recently introduced. As described in the APNs docs (https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html#//apple_ref/doc/uid/TP40008194-CH17-SW1), users should:

> Provide this key with a string value that represents the app-specific identifier for grouping notifications. The system groups notifications with the same thread identifier together in Notification Center and other system interfaces.

In practice, though, I can't find any noticeable behavior change with or without a thread ID included in notifications.

Steps to Reproduce:
Send a notifications to the APNs server with a variety of thread IDs (some with the same ID, some with different IDs, and some without thread IDs at all). Notifications with an ID will include the `thread-id` field as a property of the `aps` object, as shown in this example:

```
{"aps":{"alert":"Thread ID example","thread-id":"example-thread-id"}}
```

Expected Results:
Notifications with the same thread ID will appear in proximity to each other either on the receiving device's home screen or in Notification Center.

Actual Results:
Notifications appear in the order in which they were received, regardless of their thread ID.

Version:
iOS 10.1.1 (14B150)

Notes:
This has come up a couple of times on the APNs forums:

- https://forums.developer.apple.com/message/188955
- https://forums.developer.apple.com/thread/69520

Additional discussion is also available at https://github.com/relayrides/pushy/issues/382.

Configuration:
HTTP/2-based APNs API with token authentication

Comments

Additional discussion and reading suggests that iOS itself won't do anything with a thread ID, but will give the receiving application an opportunity to take action. From the didReceiveNotification: documentation (https://developer.apple.com/reference/usernotificationsui/unnotificationcontentextension/1648525-didreceivenotification?language=objc):

The system calls this method to deliver notifications to your Notification Content app extension. Use this method to configure the contents of your view controller or to incorporate content from a new notification. This method may be called multiple times while your view controller is visible. Specifically, it is called again when a new notification arrives whose threadIdentifier value matches the thread identifier of the notification already being displayed. The method is called on the main thread of your extension.

While I no longer believe anything is wrong from a technical perspective, I would suggest that there's an opportunity to clarify the thread-id documentation. The limited discussion in the APNs payload key reference suggests to me that the OS itself will act on a thread ID, and does not provide a link to a more detailed description of the expected behavior.

Thanks for your consideration!


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!