title: NSURLSessionDataTask delegate methods are not called
body: <p>I am trying to download some JSON from an API. Right now nothing gets printed.</p>
  
  <p>I know for sure that the path and the API Key/Value works, because I did it with the NSURLSessionDataTask with the completion handler, but I wanted to learn about how to do the same with delegate methods.</p>
  
  <p>But I cant seem to figure out why my delegate methods are not called.</p>
  
  <pre><code>@interface MetaData () &lt;NSURLSessionDelegate, NSURLSessionDataDelegate&gt;
  
  @end
  
  @implementation MetaData
  -(void)downloadData
  {
      NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
  
      [sessionConfig setHTTPAdditionalHeaders:@{ header : key}];
      NSURLSession *defaultSesh = [NSURLSession sessionWithConfiguration:sessionConfig];
      NSURLSessionDataTask *dataTask = [defaultSesh dataTaskWithURL:[NSURL URLWithString:path]];
      defaultSesh = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:nil];
      [dataTask resume];
  
  
  }
  
  - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler
  {
      NSLog(@"here 2");
  }
  
  - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data
  {
      NSLog(@"here");
      _weaponDictionary = [NSJSONSerialization JSONObjectWithData:data
                                                          options:kNilOptions
                                                            error:nil];
      NSLog(@"dictionary: %@", _weaponDictionary);
  }
  </code></pre>
  
  <p>Thanks for the help.</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>defaultSesh = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:nil];
  </code></pre>
  
  <p>by adding that line, i set the delegate to self. So now I print "here 2" but still dont print the dictionary...</p>