title: NSURLSessionDownloadTask Delegates Not Firing
body: <p>I'm playing around with a tutorial for NSURLSession. I can successfully download an image, however the delegates for download progress and download finished are not triggering. Here is the code :</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
  
      NSString * imageUrl = @"http://ichef.bbci.co.uk/naturelibrary/images/ic/credit/640x395/r/ro/rock_pigeon/rock_pigeon_1.jpg";
  
      NSURLSessionConfiguration *sessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration];
  
      NSURLSession * session = [NSURLSession sessionWithConfiguration:sessionConfiguration delegate:self delegateQueue:nil];
  
      //Download image.
      NSURLSessionDownloadTask * getImageTask = [session downloadTaskWithURL:[NSURL URLWithString:imageUrl]
  
                                                 completionHandler:^(NSURL *location, NSURLResponse *response, NSError *error) {
  
                                                     if (error) {
                                                         NSLog(@"Error sadly for you is %@", [error localizedDescription]);
                                                     }
  
                                                     UIImage * downloadedImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:location]];
  
  
  
                                                     dispatch_async(dispatch_get_main_queue(), ^ {
                                                         self.imageView.image = downloadedImage;
                                                     });
  
                                                 }];
  
      [getImageTask resume];
  
      // Do any additional setup after loading the view, typically from a nib.
  }
  
  -(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location
  {
      NSLog(@"Temporary File :%@\n", location);
      NSError *err = nil;
      NSFileManager *fileManager = [NSFileManager defaultManager];
      NSString *docsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
  
      NSURL *docsDirURL = [NSURL fileURLWithPath:[docsDir stringByAppendingPathComponent:@"out1.zip"]];
      if ([fileManager moveItemAtURL:location
                               toURL:docsDirURL
                               error: &amp;err])
      {
          NSLog(@"File is saved to =%@",docsDir);
      }
      else
      {
          NSLog(@"failed to move: %@",[err userInfo]);
      }
  
  }
  
  -(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
  {
      //You can get progress here
      NSLog(@"Received: %lld bytes (Downloaded: %lld bytes)  Expected: %lld bytes.\n",
            bytesWritten, totalBytesWritten, totalBytesExpectedToWrite);
  }
  </code></pre>
  
  <p>And in the .h file :</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface SGGViewController : UIViewController &lt;NSURLSessionDelegate&gt; {
      IBOutlet UIImageView * imageView;
  }
  
  @property (nonatomic, strong) IBOutlet UIImageView * imageView;
  
  @end
  </code></pre>
  
  <p>Can anyone suggest how to fix ?</p>