in mpush_ios_swift_demo/mpush_ios_swift_demo/AppDelegate.swift [140:162]
func handleiOS10Notification(_ notification: UNNotification) {
let content: UNNotificationContent = notification.request.content
let userInfo = content.userInfo
// 通知时间
let noticeDate = notification.date
// 标题
let title = content.title
// 副标题
let subtitle = content.subtitle
// 内容
let body = content.body
// 角标
let badge = content.badge ?? 0
// 取得通知自定义字段内容,例:获取key为"Extras"的内容
let extras = userInfo["Extras"]
// 设置角标数为0
UIApplication.shared.applicationIconBadgeNumber = 0
// 同步角标数到服务端
// self.syncBadgeNum(0)
// 通知打开回执上报
CloudPushSDK.sendNotificationAck(userInfo)
print("Notification, date: \(noticeDate), title: \(title), subtitle: \(subtitle), body: \(body), badge: \(badge), extras: \(String(describing: extras)).")
}