0
我想知道是否有辦法一個一個下載我的代碼的圖像?現在異步AFNetworking和下載圖像
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) {
completion(operation, responseObject, nil);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
[RequestAPI sharedInstance].downloadsCount -= 1;
DDLogError(@"FAIL download image: %@",error);
}];
[requestOperation start];
http://stackoverflow.com/questions/19501652/how-to-download-image-with-afnetworking-2-0 – Rushabh
你有沒有嘗試通過全局隊列來完成它? – Swati