title: How to handle remote push notifications in background?
body: <p>I want to download data when receiving a push notification while the app is not active.</p>
  
  <p>I enabled push notifications in background mode.</p>
  
  <p>This is my code :</p>
  
  <pre><code>func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -&gt; Void) {
      println("App is alive !!!")
      downloadData(){
          (success:Bool) -&gt; Void in
          println("data downloaded : \(success)")
          var result = success ? UIBackgroundFetchResult.NewData : UIBackgroundFetchResult.Failed
          completionHandler(result)
      }
  }
  </code></pre>
  
  <p>I launch the app in debug mode, I leave it. I receive a push notification. The data is not downloaded. </p>
  
  <p>I don't even know if the the <code>didReceiveRemoteNotification</code> has been called.</p>
  
  <p>What am I doing wrong ?</p>