2016-12-08 49 views
1

我们有一个IOS应用程序。它是基于服务器URL的登录。我们必须提交用户名,密码和服务器URL。但我们的Sever Web URL以HTTPS运行。但只支持HTTP URL的应用程序。我们可以通过info.plist文件启用https服务器请求吗?IOS应用程序ATS HTTPS请求配置

回答

0

你需要在你的plist中所有的东西很少,勾选这个Blog 您可以在您的Info.plist特定域添加例外:

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSExceptionDomains</key> 
    <dict> 
     <key>testdomain.com</key> 
     <dict> 
      <key>NSIncludesSubdomains</key> 
      <true/> 
      <key>NSExceptionAllowsInsecureHTTPLoads</key> 
      <true/> 
      <key>NSExceptionRequiresForwardSecrecy</key> 
      <true/> 
      <key>NSExceptionMinimumTLSVersion</key> 
      <string>TLSv1.2</string> 
      <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key> 
      <false/> 
      <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> 
      <true/> 
      <key>NSThirdPartyExceptionMinimumTLSVersion</key> 
      <string>TLSv1.2</string> 
      <key>NSRequiresCertificateTransparency</key> 
      <false/> 
     </dict> 
    </dict> 
</dict> 

您也可以忽略与单个键所有应用运输安全限制,如果你的应用有足够的理由这样做:

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