ios - Alamofire Pause Request not contine other Requests wating in Queue -


i'm using alamofire library make download manager.

  • i'm configuring alamofire manager httpmaximumconnectionsperhost = 4.

  • and i'm start downloading 5 items, 4 items start downloading , the 5th item waiting in queue.

  • when pause 1 of first 4th item, i'm expecting 5th item start downloading. not happening , issue 💃 👯

this code:

func startdownload(thisitem url: string, foldername: string) {  let startdownloadrequest = alamofiremanager!.download(.get, url,     destination: { temporaryurl, response in         let filemanager = nsfilemanager.defaultmanager()         let directoryurl = filemanager.urlsfordirectory(.documentdirectory, indomains: .userdomainmask)[0]         self.createfolderwithname(foldername)         let pathcomponent = "\(foldername)/\(response.suggestedfilename!)"                     return directoryurl.urlbyappendingpathcomponent(pathcomponent) })     .progress { bytesread, totalbytesread, totalbytesexpectedtoread in         dispatch_async(dispatch_get_main_queue())         {             let progress = string(float(totalbytesread) / float(totalbytesexpectedtoread))         }     }     .response { _, _, _, error in         if let error = error {             print("failed error: \(error)")         } else {             print("downloaded file successfully")             }         } } 

and method pause request

    func pausedownload(thisitem item: string) {     var request : request     req in downloadcenter.defaultcenter.currentdownloadslist {         if req.request?.urlstring == item {             request = req             request.suspend()             break         }     } } 

this case: start downloading 5 items, 4 downloading , 5th item waiting.. enter image description here

after pausing... enter image description here


Comments