I am facing problem related to NSoperationQueue. In my code in :
-(void) viewDidLoad
{
//Initialisation of queue and operation.
//adding operation to queue
[self.operationQueue addOperation:op];
}
-(void) viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.operationQueue cancelAllOperations];
}
So during execution of my NSOperation main function when i am checking for isCancelled property it always returns NO. Infact after calling cancellAllOperation on NSOperationQueue. eg.
-(void)main
{
if(self.isCancelled)
{
// Never executing this block :-(
}
}
For more details i am doing some network calls in my NSOperation.And when i switched to other view by then cancelAllOperation is called up. And when network response came back to in my NSOperation i am checking if(Self.isCancelled) and now i am in another view(means isCancelled should set YES). but this check always fails.