I am facing the Problem when I have updated my Xcode to 7.0 or iOS 9.0. Somehow it started giving me the Titled error
\"The resource could not be load
If you are using Xcode 8.0 and swift 3.0 or 2.2
In Swift 4 You can use
->Go Info.plist
-> Click plus of Information properties list
->Add App Transport Security Settings as dictionary
-> Click Plus icon App Transport Security Settings
-> Add Allow Arbitrary Loads set YES
Bellow image look like
You just need to use HTTPS and not HTTP in your URL and it will work
If you are using Xcode 8.0 to 8.3.3 and swift 2.2 to 3.0
In my case need to change in URL http:// to https:// (if not working then try)
Add an App Transport Security Setting: Dictionary.
Add a NSAppTransportSecurity: Dictionary.
Add a NSExceptionDomains: Dictionary.
Add a yourdomain.com: Dictionary. (Ex: stackoverflow.com)
Add Subkey named " NSIncludesSubdomains" as Boolean: YES
Add Subkey named " NSExceptionAllowsInsecureHTTPLoads" as Boolean: YES
If you use firebase, it will add NSAllowsArbitraryLoadsInWebContent = true
in the NSAppTransportSecurity
section, and NSAllowsArbitraryLoads = true
will not work
I have solved it with adding some key in info.plist. The steps I followed are:
Opened my Project target's info.plist
file
Added a Key called NSAppTransportSecurity
as a Dictionary
.
Added a Subkey called NSAllowsArbitraryLoads
as Boolean
and set its value to YES
as like following image.
Clean the Project and Now Everything is Running fine as like before.
Ref Link: https://stackoverflow.com/a/32609970
EDIT:
OR In source code of info.plist
file we can add that:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>yourdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>