title: Resume Data from URLSessionDownloadTask Always nil
body: <p>i have an app which i need to download the file from the internet when i downloading the file it's work good but my problem is when i pressed pause button to pause the downloading for one minute or more i get nil from resume Data</p>
  
  <p>the following my code : </p>
  
  <pre><code>@IBAction func startDownloading(_ sender: UIButton)
  {     
      isDownload = true
      sessionConfig = URLSessionConfiguration.default
      let operationQueue = OperationQueue.main
      session = URLSession.init(configuration: sessionConfig, delegate: self, delegateQueue: operationQueue)
      let url = URL(string: "www.example.com")
      downloadTask = session.downloadTask(with: url!)
      downloadTask.resume()
  }
  @IBAction func pause(_ sender: UIButton) 
  {
      if downloadTask != nil &amp;&amp; isDownload 
      {
          self.downloadTask!.cancel(byProducingResumeData: { (resumeData) in
                          // here is the nil from the resume data
                      })
          isDownload = false
          downloadTask = nil
          pasueBtnOutlet.setTitle("Resume", for: .normal)
      }
      if !isDownload &amp;&amp; downloadData != nil 
      {
          downloadTask = session.downloadTask(withResumeData: downloadData as Data)
          downloadTask.resume()
          isDownload = true
          downloadData = nil
          pasueBtnOutlet.setTitle("Pause", for: .normal)
      }                    
  }
  </code></pre>
  
  <p>please can help me </p>
  
  <p>thanks for all</p>