Hide local notification alert when app is terminated.

I schedule a local notification to remind me to check in at work at 8 am if I am not already checked in, the code is working fine when app is in foreground, but when I kill the app, it alway show alert no matter if I already checked in or not.

    func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {

       let isCheckedIn = AppManager.shared.isCheckedIn()
       if isCheckedIn {
                    completionHandler([])
                } else {
                    completionHandler([.list, .sound, .banner])
                }
}
Hide local notification alert when app is terminated.
 
 
Q