swift - Why is URLSession not resuming on iOS 10? -


in ios download manager

rcdownload object holds title, url, download state , resume data location of download

i have block variable called defaultsession looks this:

lazy var defaultsession: urlsession = {          let configuration = urlsessionconfiguration.background(withidentifier: "rcbackgrounddownloader")         configuration.isdiscretionary = false         configuration.sessionsendslaunchevents = true         let session = urlsession(configuration: configuration, delegate: self, delegatequeue: nil)          return session     }() 

my app able pause , resume downloads

and resume function looks this:

func resume(download: rcdownload) {          var data: data!          {             data = try data(contentsof: download.getresumedataurl())         } catch {}          download.downloadstate = downloadstatus.downloading          if data != nil {             download.downloadtask = self.defaultsession.downloadtask(withresumedata: data)             download.downloadtask?.resume()         } else {             download.downloadtask = self.defaultsession.downloadtask(with: download.downloadurl)             download.downloadtask?.resume()         }      } 

this code works on ios 9 on ios 10 not resume when kill app , reopen no errors appearing though (reminder: working on ios 9), confused there explanation ?

the bug in ios 10, apple has fix it. have fixed 10.2 version though, according thread on apple's forum.

you can stackoverflow's post. have provided solution details.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -