我正在下载一张图片,并希望展示某种形式的下载进度:
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:post.url]];
AFHTTPRequestOperation *imageOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
imageOperation.responseSerializer = [AFImageResponseSerializer serializer];
[imageOperation setDownloadProgressBlock:^(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) {
NSLog(@"bytesRead: %d, totalBytesRead: %lld, totalBytesExpected: %lld", bytesRead, totalBytesRead, totalBytesExpectedToRead);
}];
我也有一个完成块,[imageOperation start];
然后。
但是,如果我选择要下载的图像,我所记录的只是:
bytesRead:72081,totalBytesRead:72081,totalBytesExpected:72081
为什么最后只给我信息?