AlamoFire的文檔:不正確的參數標籤下載
let destination: DownloadRequest.DownloadFileDestination = { _, _ in
let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let fileURL = documentsURL.appendingPathComponent("pig.png")
return (fileURL, [.removePreviousFile, .createIntermediateDirectories])
}
我的代碼:
fileprivate let manager: Alamofire.SessionManager = { ...
let destination: DownloadRequest.DownloadFileDestination = { _, _ in
let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let fileURL = documentsURL.appendingPathComponent(".mp4")
return (fileURL, [.removePreviousFile, .createIntermediateDirectories])
}
...
self.manager.download(urlString, to: destination) { response in
相關https://stackoverflow.com/questions/41136560/setting-alamofire-custom-destination-file-name-instead-of-使用-suggesteddownloa –