【发布时间】:2013-09-08 06:14:55
【问题描述】:
我目前正在使用以下代码为 UIWebView 设置默认凭据。这在 iOS 6.1 及更早版本中运行良好。但是,在 iOS 7 Beta 6 中它根本不起作用。
我尝试加载的网页使用 Windows 身份验证。我可以在 iOS 7 的 Safari 中打开它们。但是,当我运行下面的代码,然后在 UIWebView 中打开 URL 时,我得到一个空的白色矩形并且什么都没有加载!就像我说的,这在 iOS 6.1 及更早版本中完美运行。
我还尝试了第二种方法,即使用 NSURLConnectionDelegate 传递凭据。第二种方法在 iOS 6.1 和更早版本中也可以正常工作,但在 iOS 7 中被破坏了。
有人知道为什么会这样吗?类似的经历?想法?
// Authenticate
NSURLCredential *credential = [NSURLCredential credentialWithUser:@"myusername"
password:@"mypassword"
persistence:NSURLCredentialPersistenceForSession];
NSURLProtectionSpace *protectionSpace = [[NSURLProtectionSpace alloc]
initWithHost:@"mysite.com"
port:80
protocol:@"http"
realm:nil
authenticationMethod:NSURLAuthenticationMethodDefault];
[[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential forProtectionSpace:protectionSpace];
【问题讨论】:
-
您是否尝试过在 Apple 开发者论坛中询问有关 iOS7 的问题?
-
是的 - 到目前为止没有回复
-
MPMoviePlayer 也有类似的问题
标签: iphone ios objective-c uiwebview