I've never had any problems disabling ATS in the past, but now I just can't connect to a http url at all (keep getting "ERROR: Cannot contact server with http scheme. Only https allowed"). I've tried a few things in the info.plist from reading past questions, but none of them solve the issue. Here's the current content of my info.plist
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSExceptionDomains</key> <dict> <key>domainTheAppIsTryingToContact.com</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key> <true/> </dict> </dict> </dict> Why is the above not enabling me to connect over http?
If I just use NSAllowsArbitraryLoads on its own without NSExceptionDomains it doesn't work either (I'm just experimenting using NSExceptionDomains in an attempt to get things to work) - so why therefore does the documentation for ATS state this:
If (NSAllowsArbitraryLoads) set to YES, disables all ATS restrictions for all network connections
That's not a true statement, its obviously NOT disabling all ATS restrictions for all network connections if I'm getting "ERROR: Cannot contact server with http scheme. Only https allowed"
UPDATE: I ran /usr/bin/nscurl --ats-diagnostics for the url and everything failed. However, that just brings me back to that Apple documentation statement again - if all nscurl combinations failed, then doesn't that just point to: " If (NSAllowsArbitraryLoads) set to YES, disables all ATS restrictions for all network connections" being a false statement once more.
1 Answers
Answers 1
If you are still in prototyping/development mode, you should be able to change NSAllowsArbitraryLoads to NSAllowsArbitraryLoadsInWebContent, which allowed me to run the following and load the page:
override func viewWillAppear(_ animated: Bool) { webview.load(URLRequest.init(url:URL.init(string:"http://example.com")!)) }
0 comments:
Post a Comment