我想在即将出现的图像中创建方法,所有这些图像都是一个接一个地在队列中下载。我使用AFNetworking 2.0。我想知道有什么预先创建的代码可以帮助我解决问题吗?
我的代码
NSString *urlString = link;
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
requestOperation.responseSerializer = [AFImageResponseSerializer serializer];
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
UIImage *image = responseObject;
//here I seve image to disk and so on
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
DDLogError(@"FAIL download image: %@",error);
}];发布于 2014-05-25 01:37:55
尝试使用dispatch_group:所有下载都分组到一个队列中,然后逐个下载。
https://stackoverflow.com/questions/23850502
复制相似问题