I ran into a 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]; }
Thus, during the execution of my main NSOperation function, when I check the isCancelled property, it always returns NO. Infact after calling cancelAllOperation function in NSOperationQueue. eg.
-(void)main { if(self.isCancelled) {
For more information, I am making some network calls in my NSOperation. And when I switched to another view, then cancel AllOperation is called. And when the network response returned to my NSOperation, I check if (Self.isCancelled), and now I am in a different view (then isCancelled should set YES). but this check always fails.
kidsid49
source share