title: remote push Notification when app is in background swift 3
body: <p>I have an app that receives remote push notification.
  I have implemented <code>didReceiveRemoteNotification</code>  in this way:</p>
  
  <pre><code>func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -&gt; Void) {
  
  
          print("PUSH NOTIFICATION is coming")
  
          let state: UIApplicationState = UIApplication.shared.applicationState
          let inBackground = state == .background
          let dizionario = userInfo["aps"]! as! NSDictionary
          let alert = dizionario["alert"]! as! String
          print(alert)
  
  
          if(!inBackground){
  
                  print("APP IN FOREGROUND")
                  //show alert view and the if user tap 'ok' show webview
  
               }
              else{
  
                  print("APP IS BACKGROUND")
                  //SHOW WEBVIEW
  
                }
             }
  </code></pre>
  
  <p>In both cases(when app is in foreground and background) I have to show webview that add like child to root view(tabbar controller) but if app is in foreground then I have to show , before , an alert view.
  My problem is that if app is in foreground I haven't problems , but if app is in background <code>didReceiveRemoteNotification</code> doesn't call(I don't see the print "PUSH NOTIFICATION is coming" ) and I don't understand why.</p>
  
  <p>Can you help me?</p>
  
  <p>N.B for testing I use APN Tester(<a href="https://itunes.apple.com/it/app/apn-tester-free/id626590577?mt=12" rel="nofollow noreferrer">https://itunes.apple.com/it/app/apn-tester-free/id626590577?mt=12</a>) for send push notification</p>