title: How to perform a batch of AFNetworking requests that depend on each other
body: <p>I need to perform a series of server calls that run sequentially and where one request can only be executed if all previous requests have been successful.</p>
  
  <p>So, my idea was to create an <code>AFHTTPRequestOperation</code> for each request and use <code>[myAFHTTPClient enqueueBatchOfHTTPRequestOperations:]</code> to fire them off.</p>
  
  <p>I can make them run sequentially by calling<br>
  <code>[myAFHTTPClient.operationQueue setMaxConcurrentOperationCount:1]</code></p>
  
  <p>But how can I make sure that the remaining operations run only if the previous operations were successfull?</p>
  
  <p>I tried to create a <code>completionBlock</code> for every operation that calls <code>[myAFHTTPClient cancelAllOperations]</code> in case the operation failed, but the completionBlock and the next operation in the queue run concurrently, so the next request could already be sent to the server before it gets cancelled. What should I do?</p>