How to wait for all tasks of an NSURLSession to complete?
问题 Why is NSURLSession operation queue empty after creating and resuming an NSURLSessionTask? Is there a way to tell if an NSURLSession has tasks pending? The goal is to wait for multiple tasks to complete, but this doesn't work: 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