I am trying to figure out a way to upload multiple images using AFNewtorking 2.0. I read a lot of posts here in SO, but can't find the answer I'm looking for, hope you guys can help me.
The problem is that I want to know when all the downloads have ended, and if all the images have been downloaded. So I have an array with an ant image url trying to do something like this.
for(NSString *photoUrlString in self.photos){ NSURL *url = [NSURL URLWithString:photoUrlString]; AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:[NSURLRequest requestWithURL:url]]; requestOperation.responseSerializer = [AFImageResponseSerializer serializer]; [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"Image error: %@", error); }]; [requestOperation start]; }
I found several answers by queuing these requests and setting the maximum parallel operations to 1. But I do not know how this works.
Any help is appreciated, thanks in advance!
ios objective-c afnetworking afnetworking-2
Lukas
source share