Multiple video downloading using NSOperationQueue
I have code following lines to start multiple downloads from my application. The problem is, the NSInvocation开发者_开发知识库Queue is not calling selector method, i.e. downloadMyVideos.
Can please anyone let me know, exactly what is wrong with following code?
- (void)viewWillAppear:(BOOL)animated
{
[operationQueue cancelAllOperations];
operationQueue = [[NSOperationQueue alloc] init];
[operationQueue setSuspended:YES];
indexOperation = [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(downloadMyVideo) object:nil];
[operationQueue addOperation:indexOperation];
}
You've suspended your queue.
Operations that you add to a suspended queue are not run. That could be your problem, unless you are starting the queue elsewhere.
精彩评论