title: NSURLConnection deprecated in iOS9
body: <p>I want to download a file with a <code>NSURLRequest</code> and save it but in the line with the</p>
  
  <p><code>NSData * data = ...</code> happens an error. </p>
  
  <pre><code>NSURL *Urlstring = [NSURL URLWithString:@"http://yourdomain.com/yourfile.pdf"];
  NSURLRequest *request = [NSURLRequest requestWithURL: Urlstring];
  NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
  
  NSURL *documentsURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
  documentsURL = [documentsURL URLByAppendingPathComponent:@"localFile.pdf"];
  
  [data writeToURL:documentsURL atomically:YES];
  </code></pre>
  
  <p>The warning Message is that i should use <code>NSURLSession dataTaskwithrequest</code>"because <code>sendSynchronousRequest</code> is deprecated in iOS 9 but that doesn't work I hope someone can help me</p>