我之前在 iPhone OS 3.0 中的 iPhone 应用程序中使用过 NSOperationQueue,但现在在 iOS 4.0 中代码无法正常工作。它只在所有后续调用中正常运行一次,它不起作用。iOS 4.0 中的 NSOperationQueue 有变化吗?
相关代码如下:
- (void) starteffectFunction {
NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(starteffectProcessing)
object:nil];
[queue addOperation:operation];
[operation release];
[queue release];
[spinner startAnimating];
}
-(void) starteffectProcessing{
some code executes. code snippet. A
......
this code is note supposed to execute before A completes. But this executes before A.
}