How do I set NSAppTransportSecurity at runtime?

640 Views Asked by At

I already know that I can configure NSAppTransportSecurity in my Info.plist file, setting, e.g., NSAllowsArbitraryLoads to 1 to allow WKWebView to access files over http. But suppose I want to make domain-specific exceptions, but don't know what the exceptions will be until runtime. (For instance, suppose I need http access in a dev environment, but if I find I'm in production at runtime I don't want any exceptions). Is there any way to programmatically set NSAppTransportSecurity at runtime?

0

There are 0 best solutions below