I'm having some trouble with a strange issue with NSOperationQueue. An app that I have uses it to manage download operations, so that they run "one-by-one". Unfortunately, I've found that if an operation is cancelled before it is started, the NSOperationQueue seems to freak out and run all of the operations in its queue at once for the remainder of its lifetime.
This "freak out" can be avoided by not setting "isFinished" when an operation is cancelled unless it "isExecuting", but then the queue gets stuck if an operation is cancelled before it is started.
Is there a workaround for this? Maybe replacing NSOperationQueue?
The problem turned out to be that by setting "(bool)isFinished" to be YES before the operation had started, the NSOperationQueue became confused. The solution was to set "(bool)isCancelled" to YES, and then wait until the start() method is called on the NSOperation to set "(bool)isFinished" to be YES.