【发布时间】:2016-11-21 09:59:47
【问题描述】:
我正在使用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>
谁能帮忙?
提前致谢。
【问题讨论】:
标签: objective-c ssl ios9 wkwebview