What setting do I need to put in my info.plist
to enable HTTP mode as per the following error message?
Transport security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
Assume that my domain is example.com
.
It may be worth mentioning how to get there...
Info.plist is one of the files below the Main.storyboard or viewController.swift.
When you click on it the first time, it usually is in a table format, so right click the file and 'open as' Source code and then add the code below towards the end, i.e.:
Copy paste the code just above
which is at the end.
Use:
Add a new item, NSAppTransportSecurity, in the plist file with type Dictionary, then add sub item NSAllowsArbitraryLoads in dictionary of type Boolean, and set bool value YES. This works for me.
Here are the settings visually:
If you are using Xcode 8.0 and Swift 3.0 or Swift 2.2 or even Objective C:
There are two solutions for this :
Solutions 1 :
Info.plist
file add a dictionary with key 'NSAppTransportSecurity
''Allow Arbitrary Loads'
Plist
structure should appear as shown in below image.Solution 2 :
Info.plist
file add a dictionary with key 'NSAppTransportSecurity
'NSExceptionDomains
''MyDomainName.com'
of type NSDictionaryNSIncludesSubdomains
' of typeBoolean
and value set asYES
NSTemporaryExceptionAllowsInsecureHTTPLoads
' of typeBoolean
and value set asYES
Plist
structure should appear as shown in below image.Solution 2 is preferred since it allows only selected domain whereas solution 1 allows all insecure HTTP connections.
Transport security is available on iOS 9.0 or later. You may have this warning when trying to call a WS inside your application:
Adding the following to your Info.plist will disable ATS: