{
"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"
}
这是远程推送通知有效负载。当设备收到此消息并由func didReceive(UNNotificationRequest, withContentHandler: (UNNotificationContent) -> Void)
收到时,“我的附件”会直接进入content.attachments
吗?如果我在json文件中添加更多自定义数据?会发生什么?
答案 0 :(得分:0)
您必须在Notification Service Extension file
下载您的atachment。您可以从中创建一个UNNotificationAttachment
对象,并传入UNNotificationServiceExtension子类的func didReceiveNotificationRequest(request: UNNotificationRequest, withContentHandler contentHandler: (UNNotificationContent) -> Void)
方法的completionHandler。