Incorrect argument label in call wtih AlamoFire Se

2019-07-28 18:05发布

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: enter image description here

1条回答
趁早两清
2楼-- · 2019-07-28 18:29

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)
}
查看更多
登录 后发表回答