title: NSURLConnection doesn't call NSURLConnectionDelegate authentication methods after an HTTP 401
body: <p>I'm consume a web service that uses HTTP basic auth with an <code>NSURLConnection</code>. In my <code>NSURLConnectionDelegate</code>, I implemented <code>–[NSURLConnectionDelegate connection:canAuthenticateAgainstProtectionSpace:]</code>,
  <code>–[NSURLConnectionDelegate connection:didCancelAuthenticationChallenge:]</code>, and
  <code>–[NSURLConnectionDelegate connection:didReceiveAuthenticationChallenge:]</code>, but none of them get called.</p>
  
  <p>I've tried implementing <code>–[NSURLConnectionDelegate connectionShouldUseCredentialStorage:]</code> to return both <code>YES</code> and <code>NO</code>, but that had no effect.</p>
  
  <p><a href="https://stackoverflow.com/a/1536425/9636">I also ensured that my <code>NSURLCredentialStorage</code> was empty</a>.</p>
  
  <p>Finally, instead of implementing <code>–[NSURLConnectionDelegate connection:canAuthenticateAgainstProtectionSpace:]</code>,
  <code>–[NSURLConnectionDelegate connection:didCancelAuthenticationChallenge:]</code>, and
  <code>–[NSURLConnectionDelegate connection:didReceiveAuthenticationChallenge:]</code>, I implemented <code>–[NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge:]</code>, but it wasn't called either.</p>
  
  <p>What can I do to make <code>NSURLConnection</code> call <code>NSURLConnectionDelegate</code>'s authentication callbacks?</p>