title: My applicationWillEnterForeground function is not working in Xcode 11. What can I do?
body: <p>I want to delete all local notifications from the notification center, when the app enters the  foreground. I used the applicationWillEnterForeground function in the App Delegate:</p>
  
  <pre><code>    func applicationWillEnterForeground(_ application: UIApplication) {
              let center = UNUserNotificationCenter.current()
              center.removeAllDeliveredNotifications() // To remove all delivered notifications
              center.removeAllPendingNotificationRequests()
      }
  </code></pre>
  
  <p>Unfortunately does the function not run. I read somewhere that the reason for that could be the multitasking in Xcode. My question is how I can turn off multitasking or if somebody has another idea why the function does not run.</p>