使用主机null调用的iOS9 WKWebview didReceiveAuthenticationChallenge [英] iOS9 WKWebview didReceiveAuthenticationChallenge called with host null
问题描述
我正在使用WKWebview
(iOS 9)加载 https://self-signed.badssl.com /
I am using WKWebview
(iOS 9) to load https://self-signed.badssl.com/
当调用代理didReceiveAuthenticationChallenge
时,我收到的protectionSpace
详细信息不完整,例如主机为空& authenticationMethod
是NSURLAuthenticationMethodDefault
(应该是NSURLAuthenticationMethodServerTrust
)
While as a delegate didReceiveAuthenticationChallenge
is getting called, I'm receiving incomplete protectionSpace
details e.g. host is null & authenticationMethod
is NSURLAuthenticationMethodDefault
(it should be NSURLAuthenticationMethodServerTrust
)
po challenge.protectionSpace
<NSURLProtectionSpace: 0x7ff30c40fb90>: Host:(null), Server:http, Auth-Scheme:NSURLAuthenticationMethodDefault, Realm:(null), Port:0, Proxy:NO, Proxy-Type:(null)
令人惊讶的是,如果我将新代码作为一个新项目编写(而不是在我的邮件项目中编写),则相同的代码可以正常工作.因此,我猜测这可能与某些设置有关.
Surprisingly if I'm writing fresh code as a new project(rather than writing in my mail project), the same code is working perfectly. So as I'm guessing this could be related to some settings.
注意:对于两个代码实例,ATS
都设置为true.
Note: For both the code instances, ATS
is set to true.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
任何人都可以帮忙吗?
谢谢.
推荐答案
已解决:这是由于另一个第三方库引起的.
Resolved: It was due to another Third Party Library which was causing this issue.
这篇关于使用主机null调用的iOS9 WKWebview didReceiveAuthenticationChallenge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!