0
{
  "aps": {
    "alert" : {
      "title": "Daily Sales",
      "body": "Bed"
    },
    "badge" : 1,
    "mutable-content": 1
  },
  "my-attachment" : "https://secure.img1.wfrcdn.com/lf/maxsquare/hash/36984/27677880/1/Wimbush-Panel-Bed-DBHC7470.jpg"
}

This is a remote push notification payload. When the device receive this, and received by func didReceive(UNNotificationRequest, withContentHandler: (UNNotificationContent) -> Void), will the "my-attachment" go into the content.attachments directly? if I add more customize data in the json file? what will happen?

Kurt1018
  • 83
  • 2
  • 5
  • It won't go directly in the attachments, it will be in the user info of the notification's content. See: http://stackoverflow.com/questions/39399154/media-attachment-in-ios-10-push-notifications – dan Sep 16 '16 at 21:02

1 Answers1

0

You have to download your atachment in the Notification Service Extension file. You can create an UNNotificationAttachment object out of it and pass in the completionHandler of func didReceiveNotificationRequest(request: UNNotificationRequest, withContentHandler contentHandler: (UNNotificationContent) -> Void) method of UNNotificationServiceExtension subclass.

toofani
  • 1,650
  • 13
  • 16