1

I made an application that uses UIWebView to display a site that uses basic authentication. It stopped displaying the content since iOS3.2 (on both iPhone and iPad).

My approach for authenticating users are:

  1. create a NSURLConnection
  2. implement didReceiveAuthenticationChallenge to provide the credential
  3. implement didReceiveResponse to receive the response and load the request in a UIWebView, i.e. [webView loadRequest:]

Ever since iOS3.2, the authentication was broken; UIWebView doesn't seem to check against the shared credential storage any more.

For iOS4 on iPhone, I managed to work around this issue by, stupidly, including the login informatino in the URL (i.e. https://username:[email protected]) to the initial load request passed to the webView.

For iOS3.2 on iPad, that isn't enough. The initial request is authenticated all right, but the subsequent calls still aren't authenticated.

Any suggestions?

1

1 Answer 1

-1

Use setDefaultCredential:forProtectionSpace: on the shared NSURLCredentialStorage the Webview still uses the default credential, it does not work when you use setCredential:forProtectionSpace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.