0

I wanted to show progress when downloading a large image. I am setting the image path as follows.

UIImage *backgroundImage =[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:backgoundImagePath]]];

How can i show the download progress of the image using AFNetworking framework.

Susitha
  • 3,339
  • 5
  • 27
  • 41
  • tried this: http://stackoverflow.com/questions/19145093/how-to-get-download-progress-in-afnetworking-2-0 ? – saurabh Mar 03 '15 at 10:26

1 Answers1

1

try this one,

[manager setDownloadTaskDidWriteDataBlock:^(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
float percentageDone = ((float)totalBytesWritten/(float)totalBytesExpectedToWrite)*100;
      NSLog(@"Downloading..%.f",percentageDone);   
}];
Hiren Varu
  • 1,447
  • 1
  • 9
  • 8