AlamoFire Session Manager下载中的参数标签不正确下载 [英] Incorrect argument label in call wtih AlamoFire Session Manager download

查看:88
本文介绍了AlamoFire Session Manager下载中的参数标签不正确下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AlamoFire的文档:

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])
}

我的代码:

    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:

推荐答案

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

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)
}

这篇关于AlamoFire Session Manager下载中的参数标签不正确下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆