I want to download a file with alamo fire and using alert with progress to show it but the progress will not move when alamo fire progress.fractionCompleted increased I use stat
I think your code is wrong: according to the latest Alamofire documents I make an example to show how you can modify your code:
let destination: DownloadRequest.DownloadFileDestination = { _, _ in
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory,
.userDomainMask, true)[0]
let documentsURL = URL(fileURLWithPath: documentsPath, isDirectory: true)
let fileURL = documentsURL.appendingPathComponent("myfile.pdf")
return (fileURL, [.removePreviousFile, .createIntermediateDirectories]) }
func requestDownloadInfo(url:String) {
Alamofire.download(url, to :destination)
.downloadProgress(queue: utilityQueue) { progress in
let progressDic = ["progress" : progress.completedUnitCount, "total" : progress.totalUnitCount, "fraction" : progress.fractionCompleted] as [String:Any]
// here you can show your alert using fraction value..
}
.responseData { response in
// check your file after download or check errors...
}
}