简体   繁体   English

应用程式传输安全性问题

[英]App Transport Security issue

I'm running xcode 7.2 with latest iOS SDK (9.2). 我正在使用最新的iOS SDK(9.2)运行xcode 7.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. 此处的Apple文档有关将允许ATS在特定域上允许http请求的选项的选项不再起作用。

Please see attached images: 请查看所附图片:

app.plist设置

对我网站的请求仍然被阻止

Even though I disable ATS by delete Exception Domains key & set NSAllowsArbitraryLoads to YES . 即使我通过删除Exception Domains键禁用ATS并将NSAllowsArbitraryLoads设置为YES The request still be blocked!? 该请求仍然被阻止!

Any idea? 任何想法?

just add these lines in your .plist 只需将这些行添加到您的.plist中

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

From Apple Doc 从Apple Doc

In iOS9, ATS enforces best practices during network calls, including the use of HTTPS. 在iOS9中,ATS会在网络通话期间实施最佳做法,包括使用HTTPS。

ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt. ATS可以防止意外泄露,提供安全的默认行为,并且易于采用。 You should adopt ATS as soon as possible, regardless of whether you're creating a new app or updating an existing one. 无论您是创建新应用还是更新现有应用,都应尽快采用ATS。 If you're developing a new app, you should use HTTPS exclusively. 如果要开发新的应用程序,则应专门使用HTTPS。 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. 如果您已有应用程序,则应立即使用HTTPS,并制定一个计划,以尽快迁移其余应用程序。

   <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! 希望它能起作用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM