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

Popular posts from this blog

Out of index C/C++ -

regex - PatternSyntaxException: while using String.ReplaceAll function in java? -

java - Projects which are accessed via multiple (different) IDEs: Ant or Maven? -