iosnsoperationqueuensinvocationoperation

Is it good to subclass NSInvocationOperation to add an iVar to track the kind of Operation?


I wanted to identify each of the NSInvocationOperation to identify what this operation in the isFinished in the KVO notification.

So I am planning to not to maintain the NSInvocationOperation as an iVAr in my VC. But when I get KVO notification, I wanted to be able to identify the NSInvocationOperation. So I am planning to add a tag (by subclassing the NSInvocationOperation) which can store values with which I can use to identify the operation.

Is this a good way to identify the object? Is there any alternatives?


Solution

  • You could try using Associative References in a category. It would remove the need to rewrite existing code to use your subclass.

    I've been using it in a similar case, works just fine!