我正在解决一个问题,我必须在一个队列中下载大约 10 个不同的大文件,并且我需要显示一个进度条来指示总传输的状态。我在 iOS4 中与 ASIHTTPRequest 一起工作得很好,但我正在尝试过渡到 AFNetworking,因为 ASIHTTPRequest 在 iOS5 中有问题并且不再维护。
我知道您可以使用 AFHTTPRequestOperation 的 downloadProgressBlock 报告单个请求的进度,但我似乎无法找到一种方法来报告将在同一个 NSOperationQueue 上执行的多个请求的总体进度。
有什么建议吗?谢谢!
最佳答案
[operation setUploadProgressBlock:^(NSInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {
NSLog(@"Sent %d of %d bytes", totalBytesWritten, totalBytesExpectedToWrite);
}];
操作是AFHTTPRequestOperation
关于objective-c - 从 ASIHTTPRequest 切换到 AFNetworking - ASINetworkQueue 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8056512/