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?
Asked
Active
Viewed 600 times
1

TAGraves
- 1,369
- 1
- 9
- 11
-
1Nope, `Info.plist` is the only way to set it. – Craig Siemens Mar 09 '16 at 21:43
-
There are ways to potentially load and change values in your Info.plist file at runtime, but this will break your app's code signature. – JAL Mar 09 '16 at 22:23
-
@JAL could you point me to those ways? – TAGraves Mar 09 '16 at 23:06
-
@TAGraves http://stackoverflow.com/questions/32390228/is-it-possible-to-disable-ats-in-ios-9-just-for-debug-environment here you can see how to have different value for different environment assuming you use build configurations to manage dev/prod builds. Hope this helps. – Zhao Jun 02 '16 at 21:09
-
@zhaow thanks for the response. Unfortunately this isn't quite what I was looking for, since one of our project requirements (for reasons) was to have a single build that would run in dev-mode if the device was connected to our dev network. Ultimately that requirement hasn't seemed feasible and so using different build configs is a decent alternative. – TAGraves Jun 02 '16 at 21:14