A little thought about iOS10 ATS configuration
ATS cannot restrict IP addresses
Suppose the API to invoke is/foo/bar/dosth
- If the server address is api.myserver.com, then http://api.myserver.com/foo/bar/doSth will be intercepted by the ATS because it is unsafe
- If the server address is 221.233.20.115:9090, then http://221.233.20.115:9090/foo/bar/doSth will not be intercepted by ATS, even if it is using the HTTP protocol
- This is in my other translation article Apple document translation iOS10 Nsapptransportsecurity also mentioned
Third-party SDK, also need to comply with ATS rules
That is, the third party SDK also has the risk of being filtered by ATS, currently known:
- Aurora
- Friends Union
- Baidu Map
Configuration examples
The following example makes the following configuration:
IOS10
- Web View can load any content (nsallowsarbitraryloadsinwebcontent)
- MyServer.com and all of its subdomains (for example, APIs and picture servers) can be accessed using HTTP connections
- MyServer.com and all of its subdomains can be accessed using HTTP connections (third-party SDK also needs to comply with ATS rules, so list all Third-party SDK domain names that still use HTTP requests and add them to exceptions)
IOS9
ATS completely shut down (nsallowsarbitraryloads)
<key>NSAppTransportSecurity</key>
<dict>
<key>nsallowsarbitraryloads</key >
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>myserver.com</key>
< dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key> nsincludessubdomains</key>
<true/>
</dict>
<key>jpush.cn</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key> nsexceptionallowsinsecurehttploads</key>
<true/>
</dict>
</dict>
</dict>
Thank you for reading, I hope to help you, thank you for your support for this site!