Iphone 取消AFN网络中的批处理请求

Iphone 取消AFN网络中的批处理请求,iphone,objective-c,ios,ipad,afnetworking,Iphone,Objective C,Ios,Ipad,Afnetworking,因此,我有一个批处理请求,其代码如下: [[AHClient sharedClient] enqueueBatchOfHTTPRequestOperationsWithRequests:requestArray progressBlock:^(NSUInteger numberOfCompletedOperations, NSUInteger totalNumberOfOperations) { } completionBlock:^(NSArray * operations){

因此,我有一个批处理请求,其代码如下:

[[AHClient sharedClient] enqueueBatchOfHTTPRequestOperationsWithRequests:requestArray progressBlock:^(NSUInteger numberOfCompletedOperations, NSUInteger totalNumberOfOperations) {


    } completionBlock:^(NSArray * operations){

        dispatch_async(dispatch_get_main_queue(), ^(void){
           //update the UI
        });
    }];
我尝试通过在数组中保存url路径来取消请求,并执行以下操作:

for (NSString * urlPath in self.currentRequestArray_){
        [[AHClient sharedClient] cancelAllHTTPOperationsWithMethod:@"GET" path:urlPath];
    }

但它似乎仍然会转到完成的块,即:更新UI。想法或建议?

在批处理完成块中,检查组件操作是否未取消,并且仅在其中任何操作成功完成时执行操作

completionBlock:^(NSArray * operations){ if ([[operations filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"isCancelled == NO"]] count] > 0) { dispatch_async(dispatch_get_main_queue(), ^(void){ //update the UI }); } } completionBlock:^(NSArray*操作){ 如果([[operations filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@“isCancelled==NO”]]count]>0){ dispatch\u async(dispatch\u get\u main\u queue(),^(void){ //更新用户界面 }); } }