为什么NSURLSession
创建和恢复 NSURLSessionTask 后操作队列为空?
有没有办法判断 NSURLSession 是否有待处理的任务?
目标是等待多个任务完成,但这不起作用:
NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithStreamedRequest:request];
[uploadTask resume];
// this prints "0"
NSLog(self.session.delegateQueue.operationCount)
// this returns immediately instead of waiting for task to complete
[self.session.delegateQueue waitUntilAllOperationsAreFinished];