在较旧版本的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);
}
Run Code Online (Sandbox Code Playgroud)
但是现在在新版本中,我的代码完全无法使用,并且Alamofire库中没有类似的功能.
有什么想法吗?