Alamofire
更改下载请求的方法任何人都可以帮助我如何在新方法中获取response.suggestedFilename!
?
Alamofire.download(.GET, "url", destination:
{
(temporaryURL, response) in
let pathComponent = response.suggestedFilename!
let fileManager = NSFileManager.defaultManager()
let directoryURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]
let fileUrl = directoryURL.appendingPathComponent(pathComponent)
return fileUrl!
})
答案 0 :(得分:1)
使用新的DownloadRequest.response API时会返回DefaultDownloadResponse类型。
Alamofire.download(urlString).response { response in
debugPrint(response)
print(response.temporaryURL)
}