Apple has announced that NSAllowArbitraryLoads
will not work soon. Therefore, in iOS 10, I have this in my info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>myAPIdomain</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
This works for my API request and content in UIWebView. However, in iOS9, NSAllowsArbitraryLoadsInWebContent
is not supported and it is recommended to include NSAllowsArbitraryLoads
for iOS 9 support. But I think this will override my NSExceptionDomains
settings? How can I make HTTP requests for my API and UIWebView work on both iOS 9 and iOS 10 and still following Apple's rule?
Edit
For supporting iOS 9 and iOS 10:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>myAPIdomain</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>