问题
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