in mpush_ios_swift_demo/mpush_ios_swift_demo/AppDelegate.swift [177:200]
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let userAction = response.actionIdentifier
if userAction == UNNotificationDefaultActionIdentifier {
print("User opened the notification.")
// 处理iOS 10通知,并上报通知打开回执
handleiOS10Notification(response.notification)
}
if userAction == UNNotificationDismissActionIdentifier {
print("User dismissed the notification.")
}
let customAction1 = "action1"
let customAction2 = "action2"
if userAction == customAction1 {
print("User touch custom action1.")
}
if userAction == customAction2 {
print("User touch custom action2.")
}
completionHandler()
}