2016-12-08 51 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>