iOS9 WKWebview didReceiveAuthenticationChallenge 调用时主机为空
iOS9 WKWebview didReceiveAuthenticationChallenge called with host null
我正在使用 WKWebview
(iOS 9) 加载 https://self-signed.badssl.com/
当代表 didReceiveAuthenticationChallenge
接到电话时,我收到了不完整的 protectionSpace
详细信息,例如主机为空且 authenticationMethod
为 NSURLAuthenticationMethodDefault
(应为 NSURLAuthenticationMethodServerTrust
)
po challenge.protectionSpace
<NSURLProtectionSpace: 0x7ff30c40fb90>: Host:(null), Server:http, Auth-Scheme:NSURLAuthenticationMethodDefault, Realm:(null), Port:0, Proxy:NO, Proxy-Type:(null)
令人惊讶的是,如果我将新代码编写为一个新项目(而不是在我的邮件项目中编写),相同的代码可以完美运行。所以我猜这可能与某些设置有关。
注意:对于两个代码实例,ATS
设置为 true。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
有人能帮忙吗?
提前致谢。
已解决:这是由于另一个第三方库导致了这个问题。
我正在使用 WKWebview
(iOS 9) 加载 https://self-signed.badssl.com/
当代表 didReceiveAuthenticationChallenge
接到电话时,我收到了不完整的 protectionSpace
详细信息,例如主机为空且 authenticationMethod
为 NSURLAuthenticationMethodDefault
(应为 NSURLAuthenticationMethodServerTrust
)
po challenge.protectionSpace
<NSURLProtectionSpace: 0x7ff30c40fb90>: Host:(null), Server:http, Auth-Scheme:NSURLAuthenticationMethodDefault, Realm:(null), Port:0, Proxy:NO, Proxy-Type:(null)
令人惊讶的是,如果我将新代码编写为一个新项目(而不是在我的邮件项目中编写),相同的代码可以完美运行。所以我猜这可能与某些设置有关。
注意:对于两个代码实例,ATS
设置为 true。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
有人能帮忙吗?
提前致谢。
已解决:这是由于另一个第三方库导致了这个问题。