【发布时间】:2017-05-11 11:10:34
【问题描述】:
这是我用来在前台应用时接收推送通知的代码
@available(iOS 10.0, *)
func userNotificationCenter(center: UNUserNotificationCenter, willPresentNotification notification: UNNotification, withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void)
{
completionHandler([UNNotificationPresentationOptions.Alert,UNNotificationPresentationOptions.Sound,UNNotificationPresentationOptions.Badge])
}
但我的问题是我的通知包含 [NSObject : AnyObject] 值。如何接收点赞后台通知
【问题讨论】:
-
你想从 Notification 对象访问用户信息吗?
-
@iOS_devloper 是的先生
-
我正在使用“notification.request.content.userInfo”来获取数据。你可以用上面的方法打印出来。
-
你可以使用 notification.request.content.userInfo
-
@iOS_devloper 如果它解决了该帖子,您应该将其添加为答案(如果您有它们,请加上更多细节)。干杯!
标签: ios push firebase-notifications unusernotificationcenter