2017-12-13 1 views
3

이것은 푸시 알림 페이로드입니다. ios10 getDeliveredNotifications에있어서 내부 통지 오브젝트 페이로드 키와 값을 상기 읽기getDeliveredNotifications (completionHandler :) 메소드에서 푸시 알림 페이로드 세부 정보 읽기

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

수 없다.

여기 알림 개체 세부 정보는 getDeliveredNotifications 메서드 안에 있습니다. 내가 통지 객체의 신체 키에 존재 내 알림 메시지 "새 알림"을 ​​제외하고 내 푸시 알림으로 전송 페이로드에 대한 아무런 정보가 없습니다

<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>>> 

, 통지의 모든 페이로드 키를 읽을 수있는 방법이있다 어떤 도움이라도 인정 될 것입니다.

답변

3

귀하의 페이로드는 통지 내용의 사용자 정보 사전에 있어야합니다 :

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