用AlamoFire会话pipe理器下载调用时不正确的参数标签
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
编译错误:
你所要做的就是更新方法。 您可以尝试自动填充,但不可靠。 我的猜测是方法是这种方法(默认为GET):
self.manager.download(urlString, to: destination).response { (response) in print(response) }