AFNetworking/AFNetworking — Issue #198: Completion Block Issue
Author: mjb162
Created: 2012-02-03 22:07:06+00:00
State: open

The problem I have is with the enqueueBatchOfHTTPRequestOperations:progressBlock:completionBlock method of the AFHTTPClient class. I do not know if this is suppose to be standard behavior or not, but the completion block sometimes does not execute after all the operations complete the success or failure block.

Is it supposed to be guaranteed that the complete block will execute after all the operations execute completely?

The exact problem I hit was I tried to archive a class on failure at the end the completion block, but during the failure of an individual operation, I add the operation to an array. That array is later archived in the completion block, which requires an enumeration of the array. But of course a few operations have yet to add the failed objects back into the array causing an exception.

How can I guarantee that all operations have executed their respective blocks, before I try to archive the class?