Wednesday, May 16, 2012

cancelling bath request in AFNetworking

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?





No comments:

Post a Comment