根据https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html#//apple_ref/doc/uid/TP40016198-SW14中的文档,Apple强制使用HTTPS over HTTP在iOS 9中.
App Transport Security
应用程序传输安全性(ATS)允许应用程序向其Info.plist文件添加声明,该文件指定需要与其进行安全通信的域.ATS可防止意外泄露,提供安全的默认行为,并且易于采用.无论您是创建新应用程序还是更新现有应用程序,都应尽快采用ATS.
如果您正在开发新应用,则应该专门使用HTTPS.如果您有现有应用,则应尽可能多地使用HTTPS,并创建一个计划,以便尽快迁移其余应用.
这对Web应用程序意味着什么,尤其是 Sencha Touch和Cordova/PhoneGap基于?我的Web应用程序可以配置为任何服务器地址,因此我无法在plist文件中将它们列入白名单.这仅适用于使用本机请求的应用程序(通过NSURLRequest等)吗?
对于我的应用程序,我需要为iOS的Info.plist文件添加一些设置.我认为最好的方法是将这些设置添加到我的config.xml文件中(我正在使用PhoneGap).当我将以下内容添加到config.xml文件并运行时
cordova build ios
Run Code Online (Sandbox Code Playgroud)
要么
cordova update platform ios
Run Code Online (Sandbox Code Playgroud)
我的Info.plist文件中没有添加任何内容,我完全不知道为什么会这样.构建显示"成功",所以我认为没有语法错误.
我试过了:
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<config-file target="*-Info.plist" parent="NSAppTransportSecurity">
<array>
<dict>
<key>NSExceptionDomains</key>
<array>
<dict>
<key>s3.amazonaws.com</key>
<array>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow insecure HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</array>
</dict>
</array>
</dict>
</array>
</config-file>
</platform>
Run Code Online (Sandbox Code Playgroud)
和
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<config-file target="*-Info.plist" parent="NSAppTransportSecurity">
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>s3.amazonaws.com</key>
<dict>
<!--Include to allow …Run Code Online (Sandbox Code Playgroud)