【问题标题】:Incorrect argument label in call wtih AlamoFire Session Manager download使用 AlamoFire 会话管理器下载的调用中的参数标签不正确
【发布时间】:2017-11-25 01:05:07
【问题描述】:

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

编译错误:

【问题讨论】:

标签: ios xcode swift3 alamofire


【解决方案1】:

您所要做的就是更新方法。您可以尝试自动填充,但它不可靠。我的猜测是方法是这个方法(默认为 GET):

self.manager.download(urlString, to: destination).response { 
    (response) in 
    print(response)
}

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2016-02-07
  • 2023-03-29
  • 1970-01-01
  • 1970-01-01
  • 2017-02-04
  • 2018-04-30
  • 1970-01-01
  • 2018-03-05
相关资源
最近更新 更多