iOS Swift 获取惰性地图集合值
iOS Swift Getting Lazy Map Collection Values
我正在尝试获取 "alert" 的值,但运气不太好。
LazyMapCollection<Dictionary<AnyHashable, Any>, AnyHashable>(_base: [AnyHashable("google.c.a.e"): 1, AnyHashable("google.c.a.ts"): 1475009164, AnyHashable("google.c.a.udt"): 0, AnyHashable("gcm.n.e"): 1, AnyHashable("aps"): {
alert = "test message";
}, AnyHashable("google.c.a.c_id"): 9039575328704479116, AnyHashable("gcm.message_id"): 0:1475009164740581%df6f7f01df6f7f01], _transform: (Function))
这是一个正在使用的代码,但它不能正常工作
if (userInfo["aps"] != nil) {
let msg = (userInfo["alert"] as? String)!
let alert1 = UIAlertController(title: "Notification", message: msg, preferredStyle: .alert)
alert1.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action) -> Void in
}))
self.window?.rootViewController?.present(alert1, animated: true, completion: nil)
completionHandler(.newData)
}
我正在尝试显示带有值警报消息的本地通知。任何想法,将不胜感激。谢谢
这是我的工作解决方案
if (userInfo["aps"] != nil) {
if let notification = userInfo["aps"] as? NSDictionary,
let alert = notification["alert"] as? String {
let alert1 = UIAlertController(title: "Notification", message: alert, preferredStyle: .alert)
alert1.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action) -> Void in
}))
self.window?.rootViewController?.present(alert1, animated: true, completion: nil)
completionHandler(.newData)
}
}
我正在尝试获取 "alert" 的值,但运气不太好。
LazyMapCollection<Dictionary<AnyHashable, Any>, AnyHashable>(_base: [AnyHashable("google.c.a.e"): 1, AnyHashable("google.c.a.ts"): 1475009164, AnyHashable("google.c.a.udt"): 0, AnyHashable("gcm.n.e"): 1, AnyHashable("aps"): {
alert = "test message";
}, AnyHashable("google.c.a.c_id"): 9039575328704479116, AnyHashable("gcm.message_id"): 0:1475009164740581%df6f7f01df6f7f01], _transform: (Function))
这是一个正在使用的代码,但它不能正常工作
if (userInfo["aps"] != nil) {
let msg = (userInfo["alert"] as? String)!
let alert1 = UIAlertController(title: "Notification", message: msg, preferredStyle: .alert)
alert1.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action) -> Void in
}))
self.window?.rootViewController?.present(alert1, animated: true, completion: nil)
completionHandler(.newData)
}
我正在尝试显示带有值警报消息的本地通知。任何想法,将不胜感激。谢谢
这是我的工作解决方案
if (userInfo["aps"] != nil) {
if let notification = userInfo["aps"] as? NSDictionary,
let alert = notification["alert"] as? String {
let alert1 = UIAlertController(title: "Notification", message: alert, preferredStyle: .alert)
alert1.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action) -> Void in
}))
self.window?.rootViewController?.present(alert1, animated: true, completion: nil)
completionHandler(.newData)
}
}