UIWebView中不会对iOS3.2 / iOS4的持续认证 [英] UIWebView does not persist authentication on iOS3.2/iOS4

查看:149
本文介绍了UIWebView中不会对iOS3.2 / iOS4的持续认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个使用UIWebView中显示,使用基本身份验证的网站的应用程序。它停止显示自iOS3.2的内容(在iPhone和iPad)。

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. 创建一个NSURLConnection的

  2. 实施didReceiveAuthenticationChallenge提供凭证

  3. 实施didReceiveResponse接收响应,并在一个UIWebView加载的要求,即[web视图的loadRequest:]

自从iOS3.2,认证被打破; UIWebView中似乎并没有要检查的共享凭据存储了。

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

有关iOS4的iPhone上,我设法解决此问题,愣神,包括URL登录informatino(即的 https://开头的用户名:password@www.somesite.com )传递给web视图初始加载请求

For iOS4 on iPhone, I managed to work around this issue by, stupidly, including the login informatino in the URL (i.e. https://username:password@www.somesite.com) to the initial load request passed to the webView.

有关iOS3.2 iPad上,那是不够的。初始请求被认证没事,但后续调用仍然没有身份验证。

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

有什么建议?

推荐答案

使用 setDefaultCredential:forProtectionSpace :在共享 NSURLCredentialStorage
web视图仍然使用默认的凭据,当您使用它不能正常工作 setCredential:forProtectionSpace

这篇关于UIWebView中不会对iOS3.2 / iOS4的持续认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆