__block NSInteger outstandingRequests = [requestsArray count];
for (NSURLRequest *request in requestsArray)
{
[NSURLConnection sendAsynchronousRequest:request
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
[self parseData:data];
outstandingRequests--;
if (outstandingRequests == 0)
{
[delegate finishApproveRejectAll];
}
}];
}
最佳答案
如果请求一次超过一个,则应使用NSOperationQueue