2016-09-16 7 views
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" 
} 

これはリモートプッシュ通知のペイロードです。デバイスがこれを受信し、func didReceive(UNNotificationRequest, withContentHandler: (UNNotificationContent) -> Void)で受信した場合、「my-attachment」はcontent.attachmentsに直接入りますか? jsonファイルにカスタマイズデータを追加するとどうなりますか?何が起こるか?iOS10リモートユーザ通知の受信方法

+0

添付ファイルには直接アクセスしません。通知のコンテンツのユーザー情報に表示されます。参照:http://stackoverflow.com/questions/39399154/media-attachment-in-ios-10-push-notifications – dan

答えて

0

Notification Service Extension fileにあなたの作品をダウンロードする必要があります。 UNNotificationAttachmentオブジェクトを作成し、UNHotificationServiceExtensionサブクラスのfunc didReceiveNotificationRequest(request: UNNotificationRequest, withContentHandler contentHandler: (UNNotificationContent) -> Void)メソッドのcompletionHandlerを渡すことができます。

関連する問題