title: UNUserNotificationCenter removeDeliveredNotificationRequests not removing notifications when created with UNCalendarNotificationTrigger
body: <p>I am using the newer notification APIs introduced in iOS 10 and working in Swift. 
  When I create a local notification, it shows up properly, but I am trying to remove it in my app when a relevant action occurs (so that the user doesn't have to clear it manually). But the delivered notification seems to persist.</p>
  
  <p>I am scheduling a local notification like this:</p>
  
  <pre><code>let fireDate = Date() // some date, inputted as a method parameter
  let calendar = Calendar.current
  let dateComponents = calendar.dateComponents([.day, .month, .year, .hour, .minute], from: fireDate)
  
  let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: false)
  
  let notificationContent = UNMutableNotificationContent()
  notificationContent.title = "some title"
  notificationContent.body = " some message"
  notificationContent.userInfo["custom key"] = "my custom key"
  notificationContent.badge = 1
  
  var components = DateComponents()
  components.day = 10
  notificationContent.userInfo["endDate"] = calendar.date(byAdding: components, to: fireDate) // haven't verified if this even works, but saw this as a way to set notifications to expire automatically, including for completeness
  
  let request = UNNotificationRequest(identifier: identifier, content: notificationContent, trigger: trigger)
  
  UNUserNotificationCenter.current().add(request) { (error) in
      if let error = error {
          print(error)
      }
  }
  </code></pre>
  
  <p>When an action in my app occurs such that the notification is no longer relevant, I want to remove it from the notification center, or prevent it from firing if it hasn't already:</p>
  
  <pre><code>func clearNotification(withIdentifier: String) {
      let identifiers = [identifier]
      UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: identifiers)
      UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: identifiers)
      UIApplication.shared.applicationIconBadgeNumber = UIApplication.shared.applicationIconBadgeNumber - 1
  }
  </code></pre>
  
  <p>I've checked to make sure the identifier matches properly. If the notification hasn't fired yet, it doesn't. But if the notification has fired, it will remain in the notification center seemingly indefinitely. The app badge icon does seem to work as expected, but I don't really understand what <code>removeDeliveredNotifications</code> is for if it's not for removing notifications from the notification center.</p>
  
  <p>Note: I have tested it on the simulator as well as an actual iPhone (iOS 11.2.6).</p>
  
  <p>It seems to be specifically related to <code>UNCalendarNotificationTrigger</code> because if I switch to using a <code>UNTimeIntervalNotificationTrigger</code> everything seems to work just fine. The notification based on a time interval trigger disappears when I call <code>removeAllDeliveredNotifications</code> and it shows up in <code>getDeliveredNotifications</code>. I can't understand why <code>UNCalendarNotificationTrigger</code> would behave differently (I have read in the documentation that location-based triggers are a bit different, but not calendar triggers). I suspect this is a bug in iOS.</p>
  
  <p>Edit: <strong>not a duplicate</strong> of <a href="https://stackoverflow.com/questions/38922892/how-can-i-remove-previously-delivered-notifications-when-a-new-notification-arri">this other SO question</a> since that quesiton doesn't discuss this issue at all. Might be considered a duplicate of <a href="https://stackoverflow.com/questions/48177108/difference-bwteen-untimeintervalnotificationtrigger-and-uncalendarnotificationtr">this one</a> but that one doesn't have any answers.</p>