title: ios NSOperationQueue, operations all run when added and don't queue
body: <p>So, I have a group of ASINetworkQueues that currently run together resulting in a race condition when it comes to DB saves. I am trying to create an NSOperationQueue that will will queue each of these "sub queues". I currently have created an NSOperation with a main method that kicks off the "sub queue" to start it's download.</p>
  
  <p>My problem is that each time I add a sub queue to the main queue using "addOperation" it fires that "main" method straight away so my sub queues run concurrently. I was under the impression the main method was fired one at a time. i.e. only for the operation at the top of the queue.</p>
  
  <p>Maybe i'm missing something here but I can't seem to figure out how to stall the other operations until the first one has finished. Also, I can't even seem to get my program into a situation that results in isReady = 0 for the NSOperation.. that always gives back yes.</p>
  
  <p>here's some code:</p>
  
  <p>NOTE: I have set the NSOperation queue maxConcurrentOperations to 1.</p>
  
  <p>NSOperation Main method:</p>
  
  <pre><code>-(void)main {
      [subQueue download];
  }
  </code></pre>
  
  <p>Setting up the queue:</p>
  
  <pre><code>ChapterDownloadOperation *cdo =  [[ChapterDownloadOperation alloc] init];
  cdo.chapter = ch;
  [chapterDownloadQueue addOperation:cdo];
  [cdo release];
  </code></pre>
  
  <p>If I add multiple operations the main method fires at the instance it is added to the queue. Is there another function that I should override and use for when that operation is ready to rock. I have a feeling the main method is for setting up the operation.</p>
  
  <p>Any ideas greatly appreciated.</p>
  
  <p>Thanks so much.</p>