Search code examples
iosnsoperationnsoperationqueue

When does the NSOperationQueue remove an operation from the queue?


I need to know that When does a NSOperationQueue remove an operation from the queue? I have NSOperationQueue which has list of NSOperation. At which point the NSOperationQueue removes an operation from queue?

  1. After starting an operation? OR
  2. After Finish/Cancel an operation?

Because I need a notification when all the operations in NSOPerationqueue are finished. For this I referred this link


Solution

  • According to Apple Developer Reference

    An operation queue executes its queued NSOperation objects based on their priority and readiness. After being added to an operation queue, an operation remains in its queue until it reports that it is finished with its task.

    So, NSOperationQueue removes an operation after it has been finished.

    Source - https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSOperationQueue_class/Reference/Reference.html