App Transport Security在iOS 11 Xcode 9上不再起作用

问题描述:

我一直在开发应用程序...由于禁用ATS的iOS 11更新不再起作用,因此我在info.plist中添加了以下内容

I've been working on an app...since the iOS 11 update disabling ATS does not work anymore I've added the below in the info.plist

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>

从未知域下载图像时,我无法使用域异常键. 以下是我尝试下载图片时得到的内容

I can't use the domain exception key as I am downloading images from unknown domains. below is what I get when trying to download an image

Task <C3DC30F1-5869-46F6-ABA4-5E1EC8334FD8>.<0> HTTP load failed (error code: -1005 [4:-4])
NSURLConnection finished with error - code -1005

我知道IOS 11不再支持以下内容:

I am aware that IOS 11 not longer supports the following:

  • RC4 3DES-CBC AES-CBC
  • MD5 SHA-1
  • < 2048位RSA发布密钥-与服务器的所有TLS连接
  • http://
  • SSLv3
  • TLS 1.0
  • TLS 1.1

添加以下内容,我们可以绕过ATS(应用程序传输安全性)错误:

Adding the following we can bypass the ATS (App Transport Security) error:

<key>NSAppTransportSecurity</key> <dict>
     <key>NSExceptionDomains</key>
     <dict>
         <key>mydomain.com</key>
         <dict>
             <!--Include to allow subdomains-->
             <key>NSIncludesSubdomains</key>
             <true/>
             <key>NSExceptionRequiresForwardSecrecy</key>
             <false/>
         </dict>
     </dict> </dict>

参考链接: iOS 11 ATS(应用程序传输安全性)不再接受自定义锚证书吗?