title: iOS 10 How to set UNotificationContent threadIdentifier for remote notification
body: <p><strong>TL;DR:</strong> What key needs to be set in the APNs notification payload JSON to correspond to the <code>threadIdentifier</code> property of the <code>UNNotificationContent</code> object? e.g. the <code>"category"</code> key corresponds to the <code>categoryIdentifier</code> property.</p>
  
  <hr>
  
  <p>iOS 10 introduces the <code>Notification Content Extension</code> allowing us to present a view controller when a notification is expanded.</p>
  
  <p>The view controller that we provide conforms to the <code>UNNotificationContentExtension</code> protocol, that requires us to implement the <code>didReceive(_:)</code> method.</p>
  
  <p>The documentation for this method includes the following paragraph:</p>
  
  <blockquote>
    <p>This method may be called multiple times while your view controller is visible. Specifically, it is called again when a new notification arrives whose <strong><em>threadIdentifier</em></strong> value matches the thread identifier of the notification already being displayed.</p>
  </blockquote>
  
  <p>The <code>threadIdentifier</code> property may be set in code for local notifications, but I don't know how to set it for remote notifications that are sent from the server to APNs.</p>
  
  <p>The <code>UNNotificationContent</code> documentation describes the property here: <a href="http://developer.apple.com/reference/usernotifications/unnotificationcontent" rel="nofollow">http://developer.apple.com/reference/usernotifications/unnotificationcontent</a></p>
  
  <p>The following JSON includes the keys I've tried (<code>"thread"</code> and <code>"thread-identifier"</code>):</p>
  
  <pre><code>{
      "aps" : {
          "alert" : "Hello World!",
          "sound" : "default",
          "category" : "example-category",
          "thread" : "example-thread",
          "thread-identifier" : "example-thread-identifier"
      }
      "custom-field" : "some value",
  }
  </code></pre>
  
  <p>I can't find any documentation from Apple about how to set this. Can anyone help?</p>