title: Showing the file download progress with NSURLSessionDataTask
body: <p>I want to display file download progress (how many bytes are received) of particular file. It works fine with the NSURLSessionDownloadTask .My question is I want to achieve the same with the NSURLSessionDataTask.</p>
  
  <p>Here is the code which receives file into NSData and writes to document folder:</p>
  
  <pre><code>NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];
  
  NSURLSession *defaultSession = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate: self delegateQueue: [NSOperationQueue mainQueue]];
  
  NSURLSessionDataTask * dataTask = [defaultSession dataTaskWithURL:theRessourcesURL
      completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
  { 
         if(error == nil)
         {
  
              NSString *docsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
  
                 NSString *pathToDownloadTo = [NSString stringWithFormat:@"%@/%@", docsDir, Name];
  
                 NSLog(@"SIZE : %@",[NSByteCountFormatter stringFromByteCount:data.length countStyle:NSByteCountFormatterCountStyleFile]);
  
                 [data writeToFile:pathToDownloadTo options:NSDataWritingAtomic error:&amp;error];
         }
  }];
  
  [dataTask resume];
  </code></pre>
  
  <p>I am getting file size after write or complete datatask (after the file is received) : </p>
  
  <p><code>NSLog(@"SIZE : %@",[NSByteCountFormatter stringFromByteCount:data.length countStyle:NSByteCountFormatterCountStyleFile]);</code></p>
  
  <p>But i want to display it's current bytes received status, is this possible with NSURLSessionDataTask?</p>