【发布时间】:2017-02-16 04:43:43
【问题描述】:
在旧版本的 Alamofire 中。这就是我下载文件的方式
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库中也没有类似的功能。
有什么想法吗?
【问题讨论】:
-
当我在 Google
Download File Using Alamofire 4.0 (Swift 3)上搜索时,我会得到一个指向 Alamofire 官方文档的链接,其中包含有关如何下载文件的 example。没用吗?
标签: ios swift swift3 alamofire alamofireimage