Same here, I found it this morning, right now I can solve it by distinguish the status of the application:
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
......
let userInfo = response.notification.request.content.userInfo
let application = UIApplication.shared
if cleverTap.isCleverTapNotification(userInfo) {
if application.applicationState == .background {
// Skip
} else if application.applicationState == .inactive {
// Skip
} else {
// Pass to CleverTap
CleverTap.sharedInstance()?.handleNotification(withData: userInfo)
}
}
......
}
but there must be a better way to solve it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…