I want to perform the downloads on multiple button clicks and these are buttons are created dynamically. And each button is assigned with different urls.
I want to perform multiple download operations at the same time, and also want to update the download progress of each download on different UIProgressView
s.
I was told that to use ASINetworkQueue
method, but in this one, how can I add requests dynamically to the queue? Or is there any other way or sample code?
Please help.
Sample code:
- (void)fetchThisURLFiveTimes:(NSURL *)url
{
[myQueue cancelAllOperations];
[myQueue setDownloadProgressDelegate:myProgressIndicator];
[myQueue setDelegate:self];
[myQueue setRequestDidFinishSelector:@selector(queueComplete:)];
int i;
for (i=0; i<5; i++) {
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[myQueue addOperation:request];
}
[myQueue go];
}
- (void)queueComplete:(ASINetworkQueue *)queue
{
NSLog(@"Value: %f", [myProgressIndicator progress]);
}