"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."
UserInfo={NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLStringKey=http://mysever.com/login/signin,
NSErrorFailingURLKey=http://mysever.com/login/signin, }
方法1.全局允许http请求
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
< true/>
</dict>
方法2.除白名单以外只允许https请求
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>httpDomainName.com</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
其中httpDomainName.com
替换为自己的http
的域名,白名单可以添加多个域名
网友评论