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.
Trying to download 2 objects at the same time, an out of range exception is thrown caused by this line : 208 :
self.downloadingArray[index] = downloadModel
file : MZDownloadManager.swift
look likes a race condition, since the object may be removed befor the code above is executed, which lead to that exception.
to fix this issue, I changed to previous line with the following :
if self.downloadingArray.contains(downloadModel), let objectIndex = self.downloadingArray.index(of: downloadModel) {
self.downloadingArray[objectIndex] = downloadModel
}
Hello
Trying to download 2 objects at the same time, an out of range exception is thrown caused by this line : 208 : self.downloadingArray[index] = downloadModel
file : MZDownloadManager.swift
look likes a race condition, since the object may be removed befor the code above is executed, which lead to that exception.
to fix this issue, I changed to previous line with the following :