3
저는 앱이로드 될 때 백그라운드에서 한 번만 실행되는 코드를 가지고 있습니다. NSOperationQueue *의 메모리 관리에 대해 걱정하지 않으려 고합니다. autorelease
이 될 수 있습니까? 당신이 앱 종료까지 존재하려면NSOperationQueue를 자동 취소 할 수 있습니까?
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
NSInvocationOperation *op = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(oneTimeTask) object:nil];
[queue addOperation:op];
[op release];
[queue autorelease];
감사
존재하지 않아도됩니다. 앱이 끝날 때까지 나는 마지막'NSInvocationOperation'이 완료된 후 정리하기를 원합니다. – ohho
그런 다음'NSOperation' 객체에'isFinished' 메소드를 사용하고 모든 작업이 끝나면 명시 적으로 큐를 해제하십시오. 대기열을 자동 해제하면 작업이 아직 실행 중이거나 대기 중일 때 할당이 해제 될 수 있습니다. – Macmade