首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UIWebView在iOS 9中某些时候没有加载数据

UIWebView在iOS 9中某些时候没有加载数据
EN

Stack Overflow用户
提问于 2015-09-30 07:17:38
回答 1查看 475关注 0票数 1

NSAllowsArbitraryLoads.The 9中,UIWebView没有加载(移动网页),有时是。我已经使用了ATS旁路,使用的是不总是发生的问题,并且在iOS 7和8中运行良好。调用了委托方法webViewDidStartLoad,但是webViewDidFinishLoad和didFailLoadWithError根本没有被调用。

EN

回答 1

Stack Overflow用户

发布于 2015-10-15 09:24:20

找到您需要做的solution.All是删除iOS 9中的UIWebView,并使用WKWebView.My网页对twitter、instagram等进行了一些第三方调用,这是https.Also在我的网页中遇到了Auth的挑战。(甚至我也禁用了ATS).I通过使用WKWebView找到了这一点,该WKWebView具有处理auth挑战的委托。

设置下面的委托以获取和处理该问题。

代码语言:javascript
复制
- (void)webView:(WKWebView *)webView
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler

{
    SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
    CFDataRef exceptions = SecTrustCopyExceptions(serverTrust);
    SecTrustSetExceptions(serverTrust, exceptions);
    CFRelease(exceptions);

    completionHandler(NSURLSessionAuthChallengeUseCredential,
                      [NSURLCredential credentialForTrust:serverTrust]);

}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32860125

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档