2017-12-13 6 views
3

Dies ist meine Push-Benachrichtigung Payload.Lesen Push Push-Benachrichtigung Nutzdaten in getDeliveredNotifications (CompletionHandler :) Methode

{ 
    "userId":"QA-207-222820", 
    "title":"Push new Notification", 
    "message":"New Notification", 
    "deviceId":"70", 
    "deviceName":"R70", 
    "notificationType":"1" 
} 

nicht in der Lage über Payload Schlüssel und Werte in Benachrichtigungsobjekt innerhalb getDeliveredNotifications Methode in ios10 zu lesen.

Hier ist die Benachrichtigung Objektdetails innerhalb getDeliveredNotifications Methode.

<UNNotification: 0x1742389a0; date: 2017-12-13 09:34:59 +0000, 

request: <UNNotificationRequest: 0x1742389c0; identifier: 067437A1-E8F3-4805-B6D9- 
A57BE48E9554, 

content: <UNNotificationContent: 0x17410ba30; title: (null), 
subtitle: (null), body: New Notification 
, categoryIdentifier: , launchImageName: , peopleIdentifiers: (
), threadIdentifier: , attachments: (
), badge: (null), 

sound: <UNNotificationSound: 0x1740b75e0>, 
hasDefaultAction: YES, defaultActionTitle: (null), shouldAddToNotificationsList: YES, 
shouldAlwaysAlertWhileAppIsForeground: NO, shouldLockDevice: NO, shouldPauseMedia: NO, 
isSnoozeable: NO, fromSnooze: NO, darwinNotificationName: (null), darwinSnoozedNotificationName: (null), 

trigger: <UNPushNotificationTrigger: 0x17400e2a0; contentAvailable: YES, mutableContent: NO>>> 

Es gibt keine Informationen über die Nutzlast ich in meiner Push-Benachrichtigung, außer meiner Meldung Meldung „Neue Mitteilung“, die im Körper Schlüssel in Benachrichtigungsobjekt vorhanden ist, gesendet wird, ist es eine Möglichkeit, all Payload-Tasten in der Benachrichtigung zu lesen object.Any Hilfe würde geschätzt werden.

Antwort

3

Ihre Nutzlast im Wörterbuch userinfo der Mitteilung Inhalt sein sollte:

let userInfo = notification.request.content.userInfo 
print userInfo["userId"] 
Verwandte Themen