I'm not sure about what sort of code you consider ill-suited for NSOperation
, but I'm wondering if your reticence to use NSOperation
stems from a desire to avoid writing your own NSOperation
subclass. Fortunately, using operation queues is much simpler than that. You can use NSBlockOperation
or NSInvocationOperation
to quickly create operations.
I would generally use a NSBlockOperation
:
NSOperation *completionOperation = [NSBlockOperation blockOperationWithBlock:^{
// do my image processing
[self applyMaskToImage];
}];
Or you could use a NSInvocationOperation
:
NSOperation *completionOperation = [[NSInvocationOperation alloc] initWithTarget:self
selector:@selector(applyMaskToImage)
object:nil];
You can then (a) call addDependency
for each of your two download operations, to make completionOperation
dependent upon both; and (b) add the completionOperation
to your own queue.