App Transport Security issue

情到浓时终转凉″ 提交于 2019-12-13 03:44:36

问题


I'm running xcode 7.2 with latest iOS SDK (9.2). The Apple document here regarding to the options which will enable http request to be allowed by ATS on specific domain no longer work.

Please see attached images:

Even though I disable ATS by delete Exception Domains key & set NSAllowsArbitraryLoads to YES. The request still be blocked!?

Any idea?


回答1:


just add these lines in your .plist

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



回答2:


From Apple Doc

In iOS9, ATS enforces best practices during network calls, including the use of HTTPS.

ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one. If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible.

   <key>NSAppTransportSecurity</key>
   <dict>
   <key>NSExceptionDomains</key>
   <dict>
      <key>tritome.info</key>
      <dict>
          <key>NSIncludesSubdomains</key>
          <true/>
          <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
          <true/>
          <key>NSTemporaryExceptionMinimumTLSVersion</key>
          <string>1.0</string>
          <key>NSTemporaryExceptionRequiresForwardSecrecy</key>
          <false/>
       </dict>
    </dict>
 </dict>

Hope it works!



来源:https://stackoverflow.com/questions/34946791/app-transport-security-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!