UIWebView does not support authentication on iOS3.2 / iOS4

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

My approach for user authentication:

  • create NSURLConnection
  • implement didReceiveAuthenticationChallenge to provide credentials
  • implement didReceiveResponse to receive a response and load a request into a UIWebView, i.e. [webView loadRequest:]

Since iOS3.2, authentication has been compromised; UIWebView no longer checks for shared credential storage.

For iOS4 on iPhone, I managed to get around this problem stupidly, including the login information in the URL (ie https: // username: password@www.somesite.com ) to the first download request sent to webView.

For iOS3.2 on the iPad, this is not enough. The initial request is authenticated correctly, but subsequent calls are not yet authenticated.

Any suggestions?

+1
source share
1 answer

Use setDefaultCredential:forProtectionSpace : in the NSURLCredentialStorage public folder, NSURLCredentialStorage still uses the default credentials, it does not work if you use setCredential:forProtectionSpace .

-1
source

Source: https://habr.com/ru/post/943724/


All Articles