title: Simple example of NSURLSession with authentication
body: <p>I have written a REST service that serves up some data. It is passcode protected. </p>
  
  <p>I am trying to write a background process that will grab the data and stuff it into a sqlLite db I have in the app. </p>
  
  <p>I did this initially without authentication using :</p>
  
  <pre><code>- (void) callWebService {
      dispatch_sync(kBgQueue, ^{
          NSData* data = [NSData dataWithContentsOfURL:
                          scoularDirectoryURL];
          [self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES];
      });
  }
  </code></pre>
  
  <p>This worked fine but I don't think I can add authentication to that. If I can I would just use that.</p>
  
  <p>What I am looking for is a nice, simple explanation of NSURLSession using user/password authentication. </p>