[英]How to get the topic out of a Firebase message notification in iOS?
在Android中,您可以使用getFrom()
從通知中讀取主題。 有人可以幫助我如何在iOS中了解這一點嗎?
在Appdelegate中。 實現以下功能,您可以在userInfo中獲取它。
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject],
fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
// Access userInfo
let aps = userInfo["aps"] as? NSDictionary
if let aps = aps {
let alert = aps["alert"] as! NSDictionary
let body = alert["body"] as! String
let title = alert["title"] as! String
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.