mzeeshanid / MZDownloadManager

This download manager uses NSURLSession api to download files. It can download multiple files at a time. It can download large files if app is in background. It can resume downloads if app was quit.
BSD 3-Clause "New" or "Revised" License
1.12k stars 238 forks source link

Having issues when downloading over fast network on slow devices #74

Open christie-alphero opened 5 years ago

christie-alphero commented 5 years ago

In the MZDownload.swift in the " func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64)"

I am getting a bunch of crashes. It is always an index out of bounds exception on Line 210.

It seems as though while the download model is being updated asynchrounously, the download array is updated and the downloadingArray no longer contains the download model at the index specified.

christie-alphero commented 5 years ago

I've looked into it a bit more, and adding the check just causes weird behaviour (although with no crashes). Pulling the inner logic out of the async block seems to fix the issue. Is there a reason that the inner logic is wrapped in a async block?

YogeshBhattGWL commented 1 year ago

I am getting below kind of error:

Object 0x2821a1a40 deallocated with retain count 2, reference mav have escaped from deinit. 2023-05-22 13:52:43.944428+0530 Pilgrim_app_jos[64500:11735455] Object 0x2821a1a40 deallocated with retain count 2, reference mav have escaped from deinit

@christie-alphero Do you have Any idea why its happening?