191 @IBAction func
touchupInsideDownloadingBtnAction(_ sender:AnyObject)
192 {
193 let destination =
DownloadRequest.suggestedDownloadDestination(for:.documentDirectory)
194
195 Alamofire.download(
“https://httpbin.org/image/png”,to:destination)
196 .downloadProgress { progress in
197 print(“完成比例:(progress.fractionCompleted)”)
198 print(“当前完成:(progress.completedUnitCount)”)
199 print(“总共大小:(progress.totalUnitCount)”)
200 }
201 .responseData { response in
202 if let data = response.result.value {
203 let image = UIImage(data:data)
204 }
205
206 let message = “下载图片结果:(response.result)”
207 let alert = UIAlertController(title:“Information”,
message:message, preferredStyle:
UIAlertControllerStyle.alert)
208 let OKAction = UIAlertAction(title:“OK”, style:
UIAlertActionStyle.default, handler:nil)
209 alert.addAction(OKAction)
210 self.present(alert, animated:true, completion:nil)
211 }
212
213 }