Note that there are some explanatory texts on larger screens.

plurals
  1. POAFNetworking retry failed operation with enqueueBatchOfHTTPRequestOperations
    text
    copied!<p>I'm trying to use async operation requests, but at some point operation request failed due request time out. How can I form my blocks so that, time out operations re-sent and do some operation when all operations finished failed or completed but without timeout. </p> <p>I really need to figure this out, thanks a lot!</p> <pre><code>[[SDAFParseAPIClient sharedClient] enqueueBatchOfHTTPRequestOperations:pagedOperations progressBlock:^(NSUInteger numberOfCompletedOperations, NSUInteger totalNumberOfOperations) { NSLog(@"PAGED totalNumberOfOperations: %u numberOfCompletedOperations: %u",totalNumberOfOperations,numberOfCompletedOperations); } completionBlock:^(NSArray *operations) { NSMutableArray *retryops = [NSMutableArray array]; for(AFHTTPRequestOperation *operation in operations){ if(operation.error.code == -1001){ NSLog(@"error code %d",operation.error.code); [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"comp"); //actually original completion block is needed } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"fail"); //actually original fail block is needed }]; [retryops addObject:operation]; //Do something with the response }else{ //Handle the failure } } if ([retryops count] == 0) { NSLog(@"all paginated operations completed"); } else { [[SDAFParseAPIClient sharedClient] enqueueBatchOfHTTPRequestOperations:retryops progressBlock: ^(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations) { } completionBlock: ^(NSArray *operations) { NSLog(@"all retry paginated operations completed"); }]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload