ios - How to pause/resume/cancel my download request in Alamofire -
I am downloading a file using Alamofire with progress, but I do not know how to stop / again Starting / canceling specific request has been canceled.
@IBAction function downloadBtnTapped () {Alamofire.download (.Get, "http://httpbin.org/stream/100", Destination: Destination) .progress {(bytesRead, totalBytesRead, Println in totalBytesExpectedToRead) (totalBytesRead)}. {Response, response, _, error in println} (response)}} pauseBtnTapped (this function @IBAction: UIButton) {// I want to pause / cancel my download request here} <संदर्भ>
after "text" itemprop = "text"> Keep a reference for the request made in downloadBtnTapped With a property, and pauseBtnTapped in that property Canceled call
above request:. Alamofire.Request? DownloadBtnTapped function @IBAction () {self.request = Alamofire.download (.Get, "http://httpbin.org/stream/100", Destination: Destination)} pauseBtnTapped function @IBAction (this: UIButton) {self.request ?. Cancel ()}
Comments
Post a Comment