Links
Tracking Progress with AFNetworking
[op setDownloadProgressBlock:^(NSInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) {
if (totalBytesExpectedToRead > 0) {
dispatch_async(dispatch_get_main_queue(), ^{
self.progressView.alpha = 1;
self.progressView.progress = (float)totalBytesRead / (float)totalBytesExpectedToRead;
NSString *label = [NSString stringWithFormat:@"Downloaded %lld of %lld bytes",
totalBytesRead,
totalBytesExpectedToRead];
self.progressLabel.text = label;
});
}
}];
Back