iOS App传输安全性问题 [英] iOS App Transport Security issue

查看:381
本文介绍了iOS App传输安全性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL; DR:

我有一个iOS应用程序连接到Web服务,该Web服务满足新ATS功能的最低要求.我已经修改了Info.plist以允许例外,因此我的应用程序仍可以连接到Web服务. ( NSURLSession/NSURLConnection HTTP加载在iOS 9上失败)在开发中可以正常使用,但是我刚刚推送到商店的更新仍然无法访问Web服务.我不知道断开发生在哪里或如何解决.

I have an iOS app connecting to a webservice that does not meet the minimum requirements for the new ATS feature. I have modified my Info.plist to allow an exception so my app can still connect to the webservice. (NSURLSession/NSURLConnection HTTP load failed on iOS 9 ) This works correctly in development, however, the update I just pushed to the store still fails to hit the webservice. I don't know where the disconnect is happening or how to fix this.

===

首先,这都是在模拟器中发生的,并且当我使用xcode直接部署到ipad时,行为相同:

First off, this is all happening in an emulator, and the same behavior when I deploy directly to my ipad in xcode:

我正在尝试在我的iOS应用中通过https连接到Web服务.现在,每次尝试连接到Web服务时都会出现此错误:

I am trying to connect to a webservice over https in my iOS app. I am now getting this error everytime I try to connect to the webservice:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

据我了解,这是由于新的ATS功能不允许连接而发生的.我已通过应用此修复程序( NSURLSession/NSURLConnection在iOS 9上HTTP加载失败)到我的Info.plist文件:

It is my understanding that this is happening because the new ATS feature is not allowing the connection. I have confirmed this by applying the fix (NSURLSession/NSURLConnection HTTP load failed on iOS 9) to my Info.plist file:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>mydomain.com</key>
    <dict>
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <key>NSIncludesSubdomains</key>
      <true/>
      </dict>
  </dict>
</dict>

一旦我输入了它,它就可以毫无问题地连接到Web服务.

Once I put that in, it connects to the webservice without issue.

显然,虽然我的服务器满足TLS 1.2要求和密码要求,但它不满足签名要求(

Apparantly, while my server meets the TLS 1.2 requirement, and cipher requirement, it does not meet the signature requirement (https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35 )

但是,我已经对我的应用程序进行了更新并推送到应用程序商店,但是我的应用程序的商店版本无法连接到Web服务.从xcode部署到本地计算机上时,相同的代码可以很好地构建并在设备上运行,但是商店中的版本似乎忽略了.plist修复程序. 我该如何解决?这对我完全没有意义.

However, I have made an update to my app and pushed to the app store, but the store version of my app is unable to connect to the web service. The very same code builds fine on my local machine and runs on my device when deployed to it from xcode, but the version in the store seems to be ignoring the .plist fix. How can I fix this? This makes no sense to me at all.

推荐答案

尝试将以下代码添加到您的info.plist

Try add the following code to your info.plist

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

有关更多信息,请参见链接:苹果论坛

For more information see the link:apple forum

这篇关于iOS App传输安全性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆