【发布时间】:2018-10-02 08:41:33
【问题描述】:
我已经在我的应用中实现了 firebase 推送通知。现在我收到这样的通知详细信息,
[AnyHashable("gcm.notification.details"): +12345, AnyHashable("gcm.notification.type"): video, AnyHashable("gcm.notification.group_name"): test, AnyHashable("gcm.message_id"): 0:1538469426956356%def3521bdef3521b, AnyHashable("google.c.a.e"): 1, AnyHashable("aps"): {
alert = "+12345";
}]
我试图获得价值,但我得到它 nil 像这样,
let notification = userInfo["type"] as? [AnyHashable: Any]
print(notification)
如何从通知中获取所有值?
【问题讨论】:
-
您的通知负载中似乎没有
type键。 -
我也试过这个 gcm.notification.type 但得到 nil 值。 @DávidPásztor
标签: swift firebase apple-push-notifications