Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to download multiple files in Queue in iOS
    text
    copied!<p>i need to download multiple files in queue. When i try to download single file it works perfectly fine, however when i try to download multiple file it start downloading at the same time with first download, i need to keep them in queue until first download is finished and then work with second download. I am using AFNetworking Library extension AFDownloadRequestOperation. Below is my code. Please help me regarding this, if there is any thing i am doing wrong.</p> <pre><code> NSURLRequest *request = [NSURLRequest requestWithURL:videoURL]; AFDownloadRequestOperation *operation = [[AFDownloadRequestOperation alloc] initWithRequest:request targetPath:path shouldResume:YES]; [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { if(operation.response.statusCode == 200) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Successfully Downloaded" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } }failure:^(AFHTTPRequestOperation *operation, NSError *error) { if(operation.response.statusCode!= 200) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Error While Downloaded" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } }]; [operation setProgressiveDownloadProgressBlock:^(NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpected, long long totalBytesReadForFile, long long totalBytesExpectedToReadForFile) { float percentDone = ((float)totalBytesRead) / totalBytesExpectedToReadForFile; delegate.progressDone = percentDone; [progressTableView reloadData]; }]; [operation start]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload