无法读取FCM通知用户数据,我正在尝试此 -
let userInfo = response.notification.request.content.userInfo
if let jsonResult = userInfo as? Dictionary<String, AnyObject> //**Getting error on this line**
{
if let notifyType =
jsonResult["gcm.notification.notification_type"] as? String ?? ""
{
print(notifyType)
}
}
答案 0 :(得分:3)
在你的代码中 替换:
if let notifyType =
jsonResult["gcm.notification.notification_type"] as? String ?? ""
{
使用:
if let notifyType =
jsonResult["gcm.notification.notification_type"] as? String {