热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在getDeliveredNotifications(completionHandler:)方法中读取PushNotification有效内容详细信息

如何解决《在getDeliveredNotifications(completionHandler:)方法中读取PushNotification有效内容详细信息》经验,为你挑选了1个好方法。

这是我的推送通知负载.

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

无法getDeliveredNotifications在ios10中的方法内的通知对象中读取上面的有效负载键和值.

这是getDeliveredNotifications方法内部的通知对象详细信息.

, 
hasDefaultAction: YES, defaultActionTitle: (null), shouldAddToNotificationsList: YES,
shouldAlwaysAlertWhileAppIsForeground: NO, shouldLockDevice: NO, shouldPauseMedia: NO, 
isSnoozeable: NO, fromSnooze: NO, darwinNotificationName: (null), darwinSnoozedNotificationName: (null), 

trigger: >>

没有关于我在推送通知中发送的有效负载的信息,除了通知对象中的正文密钥中存在的通知消息"新通知",是否有任何方法可以读取通知对象中的所有有效负载密钥.任何帮助将不胜感激.



1> davidethell..:

您的有效负载应位于通知内容的userInfo字典中:

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


推荐阅读
author-avatar
平平您好
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有