title: NSData dataWithContentsOfURL: not returning data for URL that shows in browser
body: <p>I am making an iOS client for the Stack Exchange API. After a long, drawn out fight I finally managed to implement authentication - which gives me a token I stick into a URL. When the token is valid, the URL looks like this:</p>
  
  <pre><code>https://api.stackexchange.com/2.1/me/associated?key=_____MY_SECRET_KEY______&amp;access_token=_____ACCESS_TOKEN_:)_____
  </code></pre>
  
  <p>which, when valid, brings me to this JSON in a webpage:</p>
  
  <pre><code>{"items":[{"site_name":"Stack Overflow","site_url":"http://stackoverflow.com","user_id":1849664,"reputation":4220,"account_id":1703573,"creation_date":1353769269,"badge_counts":{"gold":8,"silver":12,"bronze":36},"last_access_date":1375455434,"answer_count":242,"question_count":26},{"site_name":"Server Fault","site_url":"http://serverfault.com","user_id":162327,"reputation":117,"account_id":1703573,"creation_date":1362072291,"badge_counts":{"gold":0,"silver":0,"bronze":9},"last_access_date":1374722580,"answer_count":0,"question_count":4},...
  </code></pre>
  
  <p>And I get the correct JSON with this code:</p>
  
  <pre><code>NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.stackexchange.com/2.1/me/associated?key=__SECRET_KEY_:)__&amp;access_token=%@", [[NSUserDefaults standardUserDefaults] objectForKey:@"token"]]];
  NSData *jsonData = [NSData dataWithContentsOfURL:url];
  if (jsonData)
  {
      NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil];
  }
  </code></pre>
  
  <p>When I manually invalidate the token, however, the URL still looks the same, and the page in a browser displays this:</p>
  
  <pre><code>{"error_id":403,"error_name":"access_denied","error_message":"`key` is not valid for passed `access_token`, token not found."}
  </code></pre>
  
  <p>However, <strong><code>dataWithContentsOfURL:</code> is always nil</strong>. Why? What am I doing wrong?</p>
  
  <p>I do get an NSError returned: </p>
  
  <pre><code>Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x1dd1e9f0 {NSURL=https://api.stackexchange.com/2.1/me/associated?key=key((&amp;access_token=to‌​ken))}
  </code></pre>