我'm trying to configure ATS to allow http loads from my domain, but with the plist settings below it is still blocking access to image requests (but strangely, not to http ' POST'消息) . 如果我启用允许任意负载,它工作正常 . 获取图像的代码使用NSURLConnection sendAsynchronousRequest和(例如)http://www.my-domain.com/ImageStore/aFolder/bfolder/xyz.jpg的url . 我正在使用最新更新从模拟器运行 . 我找不到其他人报告类似的问题......我做错了什么?
警告信息:
App Transport Security已阻止明文HTTP(http://)资源加载,因为它不安全 . 可以通过应用程序的Info.plist文件配置临时例外 .
info.plist设置:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSExceptionDomains</key>
<dict>
<key>my-domain.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubDomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
1 回答
您正在为NSAppTransportSecurity正确设置全局设置 . 我已经包含了一个适用于我的应用程序的版本 .
来自iOS 9.0的发行说明
Apple's WWDC video与NSURLSession联网也提到了ATS