NSoperationQueue와 관련된 문제가 있습니다. 내 코드에서 : 내 NSOperation 주요 기능의 실행 중에 그래서NSoperationQueue에서 - (void) cancelAllOperations가 대기열에있는 NSOperation의 isCancelled 속성을 설정하지 않습니다.
-(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];
}
나는 항상 NO 반환의 isCancelled 속성을 검사하고 때. NSOperationQueue에서 cancellAllOperation을 호출 한 후 실제로. 예.
-(void)main
{
if(self.isCancelled)
{
// Never executing this block :-(
}
}
NSOperation.And에서 다른 네트워크로 전환 할 때 좀 더 자세한 내용을 보려면 cancelAllOperation이 호출되었습니다. 그리고 네트워크 응답 NSOperation에 돌아 왔을 때 나는 (Self.isCancelled) 그리고 지금 내가 다른보기 (isCancelled 예를 설정해야 의미)에 있는지 확인입니다. 그러나이 수표는 항상 실패합니다.
cancelAllOperations를 호출 할 때까지 작업을 시작하지 않았습니까? 작업 실행 중 설정되는 isCancelled 속성이 있는지 확인해야합니다. –
작업 기본 메소드에서 isCancelled 속성을 일관되게 확인하고 있습니다. 중단 점을 통해 디버그하고 cancelAllOperation 메서드를 호출 한 후 호출이이 검사 점으로 돌아 왔을 때 (self.isCancelled) 항상 반환되는 NO를 반환하는 것으로 나타났습니다. – kidsid49
NSOperation에서'cancel' 메서드를 재정의하고 있습니까? 그렇다면 게시 할 수 있습니까? 그렇지 않다면 오버라이드 (super 호출)하고 로그 또는 중단 점을 호출하여 호출되는지 확인할 수 있습니까? –