0
votes

I am working on an application that takes a few minutes to download a large file and write that to disk. The client has informed me that they wish to be able to cancel this at any time. What I have done is encapsulate a global URLSession that will handle the download task. Following user input I will call invalidateAndCancel() on the session. I have found that the method

urlSession(_ session: URLSession, 
        downloadTask: URLSessionDownloadTask,    
        didWriteData bytesWritten: Int64, 
   totalBytesWritten: Int64, 
   totalBytesExpectedToWrite: Int64) 

does not stop being called even after the session has been invalidated and cancelled.

QUESTION

How to I get this method to stop executing?

1

1 Answers

0
votes

Previous Thread

Try the link above I think it explains it better than I can. Also Another Reference