Ранее я делал то же самое (одновременная загрузка нескольких запросов) с помощью ASIHTTP Wrapper.
заголовочный файл
#import <UIKit/UIKit.h>
#import "ASIHTTPRequest.h"
#import "ASINetworkQueue.h"
@interface TestViewController : UIViewController {
ASINetworkQueue *networkQueue;
IBOutlet UIImageView *imageView1;
IBOutlet UIImageView *imageView2;
IBOutlet UIImageView *imageView3;
IBOutlet UIProgressView *progressIndicator;
IBOutlet UISwitch *accurateProgress;
IBOutlet UIProgressView *imageProgressIndicator1;
IBOutlet UIProgressView *imageProgressIndicator2;
IBOutlet UIProgressView *imageProgressIndicator3;
IBOutlet UILabel *imageLabel1;
IBOutlet UILabel *imageLabel2;
IBOutlet UILabel *imageLabel3;
IBOutlet UITextView *myTextView;
BOOL failed;
}
Файл реализации
- (IBAction)fetchThreeImages:(id)sender
{
[imageView1 setImage:nil];
[imageView2 setImage:nil];
[imageView3 setImage:nil];
if (!networkQueue) {
networkQueue = [[ASINetworkQueue alloc] init];
}
failed = NO;
[networkQueue reset];
[networkQueue setDownloadProgressDelegate:progressIndicator];
[networkQueue setRequestDidFinishSelector:@selector(imageFetchComplete:)];
[networkQueue setRequestDidFailSelector:@selector(imageFetchFailed:)];
[networkQueue setShowAccurateProgress:[accurateProgress isOn]];
[networkQueue setDelegate:self];
ASIHTTPRequest *request;
request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/images/small-image.jpg"]];
[request setDownloadDestinationPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"1.png"]];
[request setDownloadProgressDelegate:imageProgressIndicator1];
[request setUserInfo:[NSDictionary dictionaryWithObject:@"request1" forKey:@"name"]];
[networkQueue addOperation:request];
request = [[[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/images/medium-image.jpg"]] autorelease];
[request setDownloadDestinationPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"2.png"]];
[request setDownloadProgressDelegate:imageProgressIndicator2];
[request setUserInfo:[NSDictionary dictionaryWithObject:@"request2" forKey:@"name"]];
[networkQueue addOperation:request];
request = [[[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/images/large-image.jpg"]] autorelease];
[request setDownloadDestinationPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"3.png"]];
[request setDownloadProgressDelegate:imageProgressIndicator3];
[request setUserInfo:[NSDictionary dictionaryWithObject:@"request3" forKey:@"name"]];
[networkQueue addOperation:request];
[networkQueue go];
}
- (void)imageFetchComplete:(ASIHTTPRequest *)request
{
UIImage *img = [UIImage imageWithContentsOfFile:[request downloadDestinationPath]];
if (img) {
if ([imageView1 image]) {
if ([imageView2 image]) {
[imageView3 setImage:img];
} else {
[imageView2 setImage:img];
}
} else {
[imageView1 setImage:img];
}
}
}
- (void)imageFetchFailed:(ASIHTTPRequest *)request
{
if (!failed) {
if ([[request error] domain] != NetworkRequestErrorDomain || [[request error] code] != ASIRequestCancelledErrorType) {
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:@"Download failed" message:@"Failed to download images" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
[alertView show];
}
failed = YES;
}
}
Не стесняйтесь спрашивать, есть ли проблемы.