因此,我使用 Alamofire 和此请求发出了下载请求并返回图像、语音、视频,我能够destinationURL
通过image back 如何将它添加到 ImageView 等等现在,我还担心每次打开页面时都会调用这个函数,即使文件是在文档中下载的,这不是会丢失内存吗?并影响性能??
let destination = DownloadRequest.suggestedDownloadDestination(for: .documentDirectory)
Alamofire.download(
"url",
method: .get,
parameters: nil,
encoding: JSONEncoding.default,
headers:nil ,
to: destination).downloadProgress(closure: { (progress) in
//progress closure
}).response(completionHandler: { (DefaultDownloadResponse) in
//here you able to access the DefaultDownloadResponse
//result closure
print("*****DefaultDownloadResponse***** \(DefaultDownloadResponse.response) and \(DefaultDownloadResponse.resumeData) and \(DefaultDownloadResponse.destinationURL)")
})