So I have a batch request which is the following code:
[[AHClient sharedClient] enqueueBatchOfHTTPRequestOperationsWithRequests:requestArray progressBlock:^(NSUInteger numberOfCompletedOperations, NSUInteger totalNumberOfOperations) {
} completionBlock:^(NSArray * operations){
dispatch_async(dispatch_get_main_queue(), ^(void){
//update the UI
});
}];
I tried cancelling the request by saving the path of the url in an array and do the following:
for (NSString * urlPath in self.currentRequestArray_){
[[AHClient sharedClient] cancelAllHTTPOperationsWithMethod:@"GET" path:urlPath];
}
but it seems that it still goes to the completed block, i.e: updates the UI. Thoughts or suggestions?
In the batch completion block, check that the component operations aren't cancelled, and only perform the action if any of them finished successfully.