In Android you can use getFrom()
to read the topic from the notification. Can anybody help me how I can get to know this in iOS?
In Appdelegate. Implement below function and you can get it in 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
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.