title: URLSession.datatask with request block not called in background
body: <p><code>URLSession</code> data task block is not calling when the app is in background and it stuck at <code>dataTask</code> with request.<br>
  When I open the app the block gets called. By the way I'm using <code>https</code> request.<br>
  This is my code:</p>
  
  <pre><code>    let request = NSMutableURLRequest(url: URL(string: url as String)!,
  
                                        cachePolicy: .reloadIgnoringCacheData,
  
                                        timeoutInterval:20)
  
      request.httpMethod = method as String
  
      request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
  
      let session = URLSession.shared
  
      let data = params.data(using: String.Encoding.utf8.rawValue)
  
      request.httpBody = data
  
      session.dataTask(with: request as URLRequest,completionHandler:
  
          {(data, response, error) -&gt; Void in
  
           if error == nil
  
              {
  
                  do {
  
                      let result = try JSONSerialization.jsonObject(with: data!, options:
  
                          JSONSerialization.ReadingOptions.mutableContainers)
  
                      print(result)
  
                       completionHandler(result as AnyObject?,nil)
  
                  }
  
                  catch let JSONError as NSError{
  
                      completionHandler(nil,JSONError.localizedDescription as NSString?)
  
                  }
  
              }
  
              else{
  
                  completionHandler(nil,error!.localizedDescription as NSString?)                    
  
              }                
  
      }).resume()
  </code></pre>
  
  <p>Working perfectly when the app is in active state. Is there anything wrong in my code. please point me</p>