I am using NSOperation in my application. I am cancelling the previously executing operation when create another operation. But the previously created operation's dealloc method not calling when cancelling that operation.
Pls suggest me. Thanks.
I think what you need is that isFinished returns YES and isExecuting returns NO after cancelled. Otherwise the operation object will never be released.
Document says.
In addition to simply exiting when an operation is cancelled, it is also important that you move a cancelled operation to the appropriate final state. Specifically, if you manage the values for the isFinished and isExecuting properties yourself (perhaps because you are implementing a concurrent operation), you must update those variables accordingly. Specifically, you must change the value returned by isFinished to YES and the value returned by isExecuting to NO. You must make these changes even if the operation was cancelled before it started executing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With