полезная нагрузка вот так
{
"aps" : {
"alert" : "Notification with custom payload!",
"badge" : 1,
"content-available" : 1
},
"data" :{
"title" : "Game Request",
"body" : "Bob wants to play poker",
"action-loc-key" : "PLAY"
}
}
Считать данные полезной нагрузки
@available(iOS 10, *)
extension AppDelegate : UNUserNotificationCenterDelegate {
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let userInfo = notification.request.content.userInfo
if let aps = userInfo["aps"] as? NSDictionary
{
let alert = aps["alert"]as? NSString
let badge = aps["badge"] as? Int
}
completionHandler([.alert, .badge, .sound])
}