在旧版本的Alamofire中。这是我下载文件的方式使用Alamofire 4.0下载文件(Swift 3)
let destinationPath = Alamofire.Request.suggestedDownloadDestination(directory: .documentDirectory, domain: .userDomainMask);
Alamofire.download(.GET, urlString, destination: destinationPath)
.progress { bytesRead, totalBytesRead, totalBytesExpectedToRead in
// print(totalBytesRead)
}
.response { request, response, _, error in
let downloadedFilePath = destinationPath(URL(string: "")!, response!);
NSUserDefaultsHelper.saveURL(downloadedFilePath, key: urlString);
completion(downloadedFilePath, true);
}
但是现在在新版本中,我的代码完全无法使用,并且在Alamofire库中没有类似的功能。
有什么想法吗?
当我谷歌'下载文件使用Alamofire 4.0(SWIFT 3)',我得到一个链接到Alamofire的官方文档其中有一个[示例](https://github.com/Alamofire/Alamofire#downloading-数据到文件)如何下载文件。这没有用吗? –