title: How to auto increment notifications badge number when receiving a push notification in iOS13
body: <p>Before iOS 13 I was incrementing the app badge number when a push notification arrived in the method <code>application :didReceiveRemoteNotification:fetchCompletionHandler</code>:</p>
  
  <pre><code>    func application(_ application: UIApplication,
                       didReceiveRemoteNotification userInfo: [AnyHashable : Any],
                       fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -&gt; Void) {
          if application.applicationState == .background {
              UIApplication.shared.applicationIconBadgeNumber += 1
          }
          completionHandler(.newData)
      } 
  </code></pre>
  
  <p>Then I cleaned the badge number every time the app was opened:</p>
  
  <pre><code>   func applicationDidBecomeActive(_ application: UIApplication) {
         UIApplication.shared.applicationIconBadgeNumber = 0
     }
  </code></pre>
  
  <p>The problem is that with the <a href="https://developer.apple.com/videos/play/wwdc2019/707/?time=799" rel="noreferrer">latest changes in iOS 13</a> the method <code>application :didReceiveRemoteNotification:fetchCompletionHandler</code> is only called if the push notification has the property <code>apns-priority</code> set to at least 5. We are using a third party push notification service that doesn't send push notifications with that property.</p>
  
  <p>So my question is:</p>
  
  <p>Is there any other way that I can take to automatically increase the app badge number when receiving a push notification?</p>
  
  <p>Thanks</p>