问题
AlamoFire's documentation:
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])
}
My code:
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
compile error:
回答1:
All you have to do is update the method. You can try to autofill but its unreliable. My guess is the method is this method (which defaults to GET):
self.manager.download(urlString, to: destination).response {
(response) in
print(response)
}
来源:https://stackoverflow.com/questions/44687745/incorrect-argument-label-in-call-wtih-alamofire-session-manager-download