Apple 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 a UIWebView. However, in iOS9, NSAllowsArbitraryLoadsInWebContent
not supported, and it is recommended that you enable NSAllowsArbitraryLoads
to support iOS 9. But I think this will override my NSExceptionDomains
settings? How can I make HTTP requests for my API and UIWebView to work on both iOS 9 and iOS 10 and still follow the Apple rule?
Edit
To support 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>
source share