在属性 NSAppTransportSecurity 下的 info.plist 中,我添加了一组与我的应用程序通信的域。但是由于某些原因,我的设置仅适用于某些添加的域,而不适用于所有域,但我不知道为什么。对于任何想法,我都会非常有帮助。提前致谢。
例如,现在它适用于域 googleapis.com,但不适用于 imeteo.sk、imeteo.cz 或任何子域 ( http://m.imeteo.cz )
这是我的 info.plist 的片段
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowExceptionDomains</key>
<dict>
<key>imeteo.cz</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>imeteo.sk</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>googleapis.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
在尝试在 webview 中加载其中一些域或子域后,我得到了这个:
App Transport Security 已阻止明文 HTTP (http://) 资源加载,因为它不安全。可以通过应用程序的 Info.plist 文件配置临时例外。