ChatGPT解决这个技术问题 Extra ChatGPT

Transport security has blocked a cleartext HTTP

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.

https://i.stack.imgur.com/phCr2.png

Assume that my domain is example.com.

Moderator Note: There are already 36 answers to this question. Before adding another, please make sure your solution is new.
NOTE: Solutions here suggest that you should turn ATS off (Allow arbitary loads). Soon this won't be possible since Apple will require ATS (Originally the end of the year - deadline has been extended) - developer.apple.com/news/?id=12212016b
@Jeef why have you added iOS 10 tag? were there any additional changes in iOS 10 in that matter? I feel that it was introduced in iOS9 and that tag should be sufficient in terms of iOS versions

G
Gaurav Singla

Use NSAppTransportSecurity:

https://i.stack.imgur.com/CJ8FA.png

You have to set the NSAllowsArbitraryLoads key to YES under NSAppTransportSecurity dictionary in your info.plist file.

https://i.stack.imgur.com/QSnGS.png


Let it be known: THIS IS A WORKAROUND! Anytime you're using HTTP over HTTPS you are opening up your user's device(s) to vulnerabilities. Sure it's unlikely in many cases but ethical programming is best practice. Just sayin' ... - also, +1 for the working (for testing purposes)
This is NOT a solution - this is a HACK! To add individual domain "exceptions" see this answer below: stackoverflow.com/a/32560433/1103584
While this solution is known to be vulnerable, it is the only solution I would recommend during DEVELOPMENT. Having to type in every exact domain during development is just silly (especially if you are using third party web services).
Name of those keys have changed now "App Transport Security Settings" under that "Allow Arbitrary Loads"
Why are so many people against this solution? This definitely is NOT a hack! Many apps need to communicate to the actual internet where the security protocol is not always under your control. For example, it seems very reasonable to be able to show images from other servers that don't have an SSL certificate.
U
Undo

Here are the settings visually:

https://i.stack.imgur.com/LqXFE.png


I don't have that option.
If you open your Info.plist directly you can just add the NSAppTransportSecurity dictionary, and then create the NSAllowsArbitraryLoads item within that (see the answer edited by Umar Farooq, below).
Same here -- exception domains didn't work with 7.3 for me.
This option does not exist - XCode 7.3.1
The info from @JoshPinter worked for me with XCode 8.
N
Neur0

See the forum post Application Transport Security?.

For example, you can add a specific domain like:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>example.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>

The lazy option is:

<key>NSAppTransportSecurity</key>
<dict>
  <!--Include to allow all connections (DANGER)-->
  <key>NSAllowsArbitraryLoads</key>
      <true/>
</dict>

###Note:

info.plist is an XML file so you can place this code more or less anywhere inside the file.


How can I do that, I mean what is the way to add this code to the Info.plist because I do not know where to paste this code?
@lmiguelvargasf open your info.plist in a plain text editor
I still get the error: exception domain is set and NSAllowsArbitraryLoads is false. Even with NSAllowsArbitraryLoads set true the error shows up. Does anyone else here have this issue?
As of 1/30/2016 Apple doc shows that the keys no longer have the Temporary word in them, e.g.: NSExceptionAllowsInsecureHTTPLoads NSExceptionMinimumTLSVersion See developer.apple.com/library/prerelease/ios/documentation/…
In case anyone else is pulling their hair out because doing these simple changes to info.plist isn't working.. add the changes to Project>Target>Info>Custom iOS Target Properties
I
Itay Brenner

If you are using Xcode 8.0+ and Swift 2.2+ or even Objective C:

https://i.stack.imgur.com/8OCcm.png

If you want to allow HTTP connections to any site, you can use this keys:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

If you know which domains you will connect to add:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>example.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>

Why is NSAllowsArbitraryLoads set to true? You subvert the purpose of ATS. Also see The most dangerous code in the world: validating SSL certificates in non-browser software. Your software just made the list.
@jww This is the purpose of this post. The site I need to connect to to play audio doesn't use HTTPS yet and I'm not trying to wait.
This will not work in iOS 10.0+ or MacOS 10.12+ It actually says to allow all arbitrary loads EXCEPT those mentioned (example.com). Thus it would do the reverse of what is desired. NSAllowsArbirtraryLoads should be set to false here. more info: Apple docs
Agree, why on earth is everybody upvoting this ? there is no point using NSAllowsArbitraryLoads if you set an exception domain.
NSAllowsArbitraryLoads does not need to be true, so it must be removed. NSExceptionDomains is enough which enables nonsecure connection to that domain only. NSAllowsArbitraryLoads = true will enable nonsecure connection to any domain so if still setting it to true makes the NSExceptionDomains nonsense to have as it includes all domains already
T
Tamás Sengel

This was tested and was working on iOS 9 GM seed - this is the configuration to allow a specific domain to use HTTP instead of HTTPS:

<key>NSAppTransportSecurity</key>
<dict>
      <key>NSAllowsArbitraryLoads</key> 
      <false/>
       <key>NSExceptionDomains</key>
       <dict>
            <key>example.com</key> <!--Include your domain at this line -->
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSTemporaryExceptionMinimumTLSVersion</key>
                <string>TLSv1.1</string>
            </dict>
       </dict>
</dict>

NSAllowsArbitraryLoads must be false, because it disallows all insecure connection, but the exceptions list allows connection to some domains without HTTPS.

Here it is visually:

https://i.stack.imgur.com/53vEo.png


THIS should be marked as the answer. Tested and working on iOS 9 GM seed to allow a specific domain to use http without taking the "lazy" way and completely opening your app up.
How do I add this to my info.plist?
Ok I added that entry to my info.plist and I'm still getting this error - " App 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."
@RomanShapovalov if you must use an IP address, try adding .xip.io to the end of the IP address and add xip.io to your NSExceptionDomains. See xip.io. I connect directly to IP when developing (but not release) and this works great for me.
Wasn't working for me until I realised I had put it in the wrong info.plist in my test project. Make sure you put it in the right one!
J
Julian

This is a quick workaround (but not recommended) to add this in the plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Which means (according to Apple's documentation):

NSAllowsArbitraryLoads A Boolean value used to disable App Transport Security for any domains not listed in the NSExceptionDomains dictionary. Listed domains use the settings specified for that domain. The default value of NO requires the default App Transport Security behaviour for all connections.

I really recommend links:

Apple's technical note

WWDC 2015 session 706 (Security and Your Apps) starts around 1:50

WWDC 2015 session 711 (Networking with NSURLSession)

Blog post Shipping an App With App Transport Security

which help me understand reasons and all the implications.

The XML (in file Info.plist) below will:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <false/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>PAGE_FOR_WHICH_SETTINGS_YOU_WANT_TO_OVERRIDE</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>

disallow arbitrary calls for all pages, but for PAGE_FOR_WHICH_SETTINGS_YOU_WANT_TO_OVERRIDE will allow that connections use the HTTP protocol.

To the XML above you can add:

<key>NSIncludesSubdomains</key>
<true/>

if you want to allow insecure connections for the subdomains of the specified address.

The best approach is to block all arbitrary loads (set to false) and add exceptions to allow only addresses we know are fine.

For interested readers

2018 Update:

Apple is not recommending switching this off - more information can be found in 207 session WWDC 2018 with more things explained in regards to security

Leaving the original answer for historic reasons and development phase


NSAllowsArbitraryLoads must be false
@SoundBlaster for what case and what you see wrong in my answer to down vote?
by adding in plist(NSAppTransportSecurity NSAllowsArbitraryLoads), all web service working fine except one web service one web service return internal server error (500) in iOS 9 but working fine in iOS8 or later
@SoundBlaster made a change, now you shouldn't have objections :)
Thanks, how do you actually add the <key>NSIncludesSubdomains</key> <true/> ? Does every setting have to be surrounded by <dict>? how do you edit this damn plist file? What's the formatting? :D Thank you.
j
jww

For those of you who want a more context on why this is happening, in addition to how to fix it, then read below.

With the introduction of iOS 9, to improve the security of connections between an app and web services, secure connections between an app and its web service must follow best practices. The best practices behavior is enforced by the App Transport Security to:

prevent accidental disclosure, and

provide a default behavior that is secure.

As explained in the App Transport Security Technote, when communicating with your web service, App Transport Security now has the following requirements and behavior:

The server must support at least Transport Layer Security (TLS) protocol version 1.2. Connection ciphers are limited to those that provide forward secrecy (see the list of ciphers below.) Certificates must be signed using a SHA256 or better signature hash algorithm, with either a 2048 bit or greater RSA key or a 256 bit or greater Elliptic-Curve (ECC) key. Invalid certificates result in a hard failure and no connection.

In other words, your web service request should: a.) use HTTPS and b.) be encrypted using TLS v1.2 with forward secrecy.

However, as was mentioned in other posts, you can override this new behavior from App Transport Security by specifying the insecure domain in the Info.plist of your app.

To override, you will need to add the NSAppTransportSecurity > NSExceptionDomains dictionary properties to your Info.plist. Next, you will add your web service's domain to the NSExceptionDomains dictionary.

For example, if I want to bypass the App Transport Security behavior for a web service on the host www.yourwebservicehost.com then I would do the following:

Open your app in Xcode. Find the Info.plist file in Project Navigator and "right-mouse" click on it and choose the Open As > Source Code menu option. The property list file will appear in the right pane. Put the following properties block inside of the main properties dictionary (under the first ).

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>www.example.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.1</string>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>

If you need to provide exceptions for additional domains then you would add another dictionary property beneath NSExceptionDomains.

To find out more about the keys referenced above, read this already mentioned technote.


This worked in 2 of my apps, but it's not working on a 3rd one. Has anyone else encountered a situation of using the above fix and still getting the same error message? (and yes I updated the dictionary to use my API domain, not the one in the code)
Best ! Apple confirms that this solution using
This worked for a Cordova/Phonegap/Ionic app editing file ./platforms/ios/<project>/<project>-Info.plist with NSAllowsArbitraryLoads=false and many exception domains to services with varying TLS/HTTP/HTTPS combinations. Initially used NSAllowsArbitraryLoads=true then adjusted, troubleshooting the rules through trial and error to comply with guidelines and submit for approval. Note config.xml <access origin=.../> statements partially populate this file, but currently requires adjustment by direct editing or via XCode to get the details correct.
Also <access origin="*"/> (in config.xml) sets NSAllowsArbitraryLoads=true (for Cordova/Phonegap/hybrid apps
Why is NSExceptionAllowsInsecureHTTPLoads set to true? You subvert the purpose of ATS. Also see The most dangerous code in the world: validating SSL certificates in non-browser software. Your software just made the list.
g
gondo

I do not like editing the plist directly. You can easily add it to the plist using the GUI:

Click on the Info.plist in the Navigator on the left.

Now change the data in the main area: On the last line add the + Enter the name of the group: App Transport Security Settings Right click on the group and select Add Row Enter Allow Arbitrary Loads Set the value on the right to YES

On the last line add the +

Enter the name of the group: App Transport Security Settings

Right click on the group and select Add Row

Enter Allow Arbitrary Loads

Set the value on the right to YES

https://i.stack.imgur.com/PaFlE.png


To clarify: if "Allow Arbitrary Loads" is YES, and there are "Exception Domains", then the loads that are allowed are restricted to the ones in the Exception Domains. Is that correct?
is that a safe way to do it if I want to release the application?
No. By allowing arbitrary loads, your app can connect to any domains freely. In security point of view, you should control & limit which domain / website should the app connect to, to avoid unexpected network usage.
Most apps route only to known servers. This is controlled by the developer. So the security Issues are known.
Why is NSAllowsArbitraryLoads set to YES? You subvert the purpose of ATS. Also see The most dangerous code in the world: validating SSL certificates in non-browser software. Your software just made the list.
J
Jayprakash Dubey

https://i.stack.imgur.com/073wY.png

https://i.stack.imgur.com/7QkhE.png

There are two solutions for this :

Solutions 1 :

In Info.plist file add a dictionary with key 'NSAppTransportSecurity' Add another element inside dictionary with key 'Allow Arbitrary Loads'

Plist structure should appear as shown in below image.

https://i.stack.imgur.com/ao49Y.png

Solution 2 :

In Info.plist file add a dictionary with key 'NSAppTransportSecurity' Add another element inside dictionary with key 'NSExceptionDomains' Add element with key 'MyDomainName.com' of type NSDictionary Add element with key 'NSIncludesSubdomains' of type Boolean and value set as YES Add element with key 'NSTemporaryExceptionAllowsInsecureHTTPLoads' of type Boolean and value set as YES

Plist structure should appear as shown in below image.

https://i.stack.imgur.com/Gv9nB.png

Solution 2 is preferred since it allows only selected domain whereas solution 1 allows all insecure HTTP connections.


Why is NSAllowsArbitraryLoads set to YES? You subvert the purpose of ATS. Also see The most dangerous code in the world: validating SSL certificates in non-browser software. Your software just made the list.
P
Peter Mortensen

Transport security is available on iOS 9.0 or later. You may have this warning when trying to call a WS inside your application:

Application 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.

Adding the following to your Info.plist will disable ATS:

<key>NSAppTransportSecurity</key>
<dict>
     <key>NSAllowsArbitraryLoads</key><true/>
</dict>

NSAllowsArbitraryLoads must be false, if true it allows all insecure connection
by adding in plist all web service working fine except one web service one web service return internal server error (500) in iOS 9 but working fine in iOS8 or later
Accepted on the store?
Very bad advice; see The most dangerous code in the world: validating SSL certificates in non-browser software. Given the question if full of the recommended way to do things, "me too" answers like this are not needed.
M
Mojtaba Hosseini

⛔️ Don't use bad practices!

Many of the answers (including the accepted one) tell you to make your app's network communication entirely unsecured! by setting the Allow Arbitrary Loads to Yes (or true). That is the most dangerous setting for network requests! And it is ONLY for testing and temporary purposes.

https://i.stack.imgur.com/4Bg53.jpg

✅ Set Allow Arbitrary Loads to NO !!!

You must always use HTTPS for your networking stuff. But if you really can't, just add an exception to the info.plist

For example, if you are using http://google.com and getting that error, You MUST change it to https://google.com (with s) since it supports perfectly.

But if you can't somehow, (and you cant convince backend developers to support SSL), add JUST this unsecured domain to the info.plist (instead of making it available for ALL UNSECURE NET!)

https://i.stack.imgur.com/Ac699.png


P
Peter Mortensen

Development Example

Here is a screenshot of a plist which keeps ATS intact (=secure), but allows that connections to localhost can be made via HTTP instead of HTTPS. It works in Xcode 7.1.1.

https://i.stack.imgur.com/o6x8f.png


Are there any ways to make localhost secure, i.e. using HTTPS, in react-native so that we do not have to use the default NSExceptionAllowsInsecureHTTPLoads - YES config?
j
jww

According to Apple, generally disabling ATS will lead to app rejection, unless you have a good reason to do so. Even then, you should add exceptions for domains that you can access safely.

Apple has an excellent tool that tells you exactly what settings to use: In Terminal, enter

/usr/bin/nscurl --ats-diagnostics --verbose https://www.example.com/whatever

and nscurl will check whether this request fails, and then try a variety of settings and tell you exactly which one passes, and what to do. For example, for some third-party URL that I visit, this command told me that this dictionary passes:

{
    NSExceptionDomains = {
        "www.example.com" = {
            NSExceptionRequiresForwardSecrecy = false;
        };
    };
}

To distinguish between your own sites and third-party sites that are out of your control, use, for example, the key NSThirdPartyExceptionRequiresForwardSecrecy.


its great tool to check before actually test with the application. save time. but any resource to read to understand the out put of this command.
Interesting tool. In my case it overstates things though. It lists three keys including NSExceptionAllowsInsecureHTTPLoads = true;, but it turns out that one's not needed.
S
Shailendra Suriyal

Go to your Info.plist

Right Click on empty space and Click on Add Row Write the Key Name as NSAppTransportSecurity, Under it Select Exception Domains, Add a new item to this Write down your domain name that needs to get accessed Change the Domain type from String to Dictionary, add a new Item NSTemporaryExceptionAllowsInsecureHTTPLoads, that will be a boolean with a true value.


Why is NSAllowsArbitraryLoads set to true? You subvert the purpose of ATS. Also see The most dangerous code in the world: validating SSL certificates in non-browser software. Your software just made the list.
e
ecotax

Figuring out what settings to use can be performed automatically, as mentioned in this technote:

/usr/bin/nscurl --ats-diagnostics --verbose https://your-domain.com

You do need OS X 10.11 (El Capitan) for this, apparently.
O
ObjectiveTC

NOTE: The exception domain in your plist should be in LOWER-CASE.

Example: you have named your machine "MyAwesomeMacbook" under Settings->Sharing; your server (for test purposes) is running on MyAwesomeMacbook.local:3000, and your app needs to send a request to http://MyAwesomeMacbook.local:3000/files..., your plist you will need to specify "myawesomemacbook.local" as the exception domain.

--

Your info.plist would contain...

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>myawesomemacbook.local</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSExceptionAllowsInsecureHTTPLoads</key>
      <true/>
    </dict>
  </dict>
</dict>

P
Peter Mortensen

Use:

https://i.stack.imgur.com/WTTGJ.png

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.


NSAllowsArbitraryLoads must be false, if true it allows all insecure connection
by adding in plist all web service working fine except one web service one web service return internal server error (500) in iOS 9 but working fine in iOS8 or later @ThiagoArreguy
Very bad advice; see The most dangerous code in the world: validating SSL certificates in non-browser software. Given the question if full of the recommended way to do things, "me too" answers like this are not needed.
I Know its a bad advice, but it's just a solution for the time being in development mode only. Apple has provided us flexibility, if its that much bad, they wouldn't allow this.
P
Peter Mortensen

On 2015-09-25 (after Xcode updates on 2015-09-18):

I used a non-lazy method, but it didn't work. The followings are my tries.

First,

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>www.xxx.yyy.zzz</key>
        <dict>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>TLSv1.1</string>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>

And second,

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>www.xxx.yyy.zzz</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.1</string>
            <key>NSIncludesSubdomains</key>
            <true/>
        </dict>
    </dict>
</dict>

Finally, I used the lazy method:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

It might be a little insecure, but I couldn't find other solutions.


Why is NSAllowsArbitraryLoads set to true? You subvert the purpose of ATS. Also see The most dangerous code in the world: validating SSL certificates in non-browser software. Your software just made the list.
F
Faris

In swift 4 and xocde 10 is change the NSAllowsArbitraryLoads to Allow Arbitrary Loads. so it is going to be look like this :

<key>App Transport Security Settings</key>
<dict>
     <key>Allow Arbitrary Loads</key><true/>
</dict>

P
Peter Mortensen

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.:

 <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict>

Copy paste the code just above

 "</dict>
</plist>"

which is at the end.


Why is NSAllowsArbitraryLoads set to true? You subvert the purpose of ATS. Also see The most dangerous code in the world: validating SSL certificates in non-browser software. Your software just made the list.
K
Kamani Jasmin

How to fix it?

https://i.stack.imgur.com/JsBVM.png

Below steps to fix it.

https://i.stack.imgur.com/o4uyS.png


P
Peter Mortensen

Update for Xcode 7.1, facing problem 27.10.15:

The new value in the Info.plist is "App Transport Security Settings". From there, this dictionary should contain:

Allow Arbitrary Loads = YES

Exception Domains (insert here your http domain)


s
shim

For those who came here trying to find the reason why their WKWebView is always white and loads nothing (exactly as described here how do I get WKWebView to work in swift and for an macOS App) :

If all the rocket science above does not work for you check the obvious: the sandbox settings

https://i.stack.imgur.com/jlgoZ.png

Being new to swift and cocoa, but pretty experienced in programming I've spend about 20 hours to find this solution. None of dozens hipster-iOS-tutorials nor apple keynotes – nothing mentions this small checkbox.


Oh my god, thank you so much! You saved me the same 20 hour search!
not seeing that section in the Capabilities section of the target (Xcode 9.4.1)
v
vrat2801

By default, iOS only allows HTTPS API. Since HTTP is not secure, you will have to disable App transport security. There are two ways to disable ATS:-

1. Adding source code in project info.plist and add the following code in root tag.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

2. Using project info.

Click on project on the project on the left pane, select the project as target and choose info tab. You have to add the dictionary in the following structure.

https://i.stack.imgur.com/w9sZn.png


S
Sanjay Mali

** Finally!!! Resolved App transport Security **

  1. Follow the follow the screen shot. Do it in Targets info Section.

https://i.stack.imgur.com/2ETja.jpg


N
Nächste woche

Using NSExceptionDomains may not apply an effect simultaneously due to target site may load resources (e.g. js files) from external domains over http. It can be resolved by adding these external domains to NSExceptionDomains as well.

To inspect which resources cannot be loaded try to use Remote debugging. Here is a tutorial: http://geeklearning.io/apache-cordova-and-remote-debugging-on-ios/


A
Abishek Thangaraj

In Swift 5 we have two way to overcome this problem. we need to add the NSAppTransportSecurity in info.plist

I give the info.plist sourcecode and image for reference

First one is Add the NSAppTransportSecurity -> NSAllowsArbitraryLoads in info.plist.

https://i.stack.imgur.com/T3Uja.png

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <false/>
    </dict>
</dict>
</plist>

Another one method is Add the NSAppTransportSecurity -> NSExceptionDomains in info.plist and add the domain of the URL and enable the permissions to load there sub-domains(NSIncludesSubdomains) and Allow the insecure HTTP loads(NSExceptionAllowsInsecureHTTPLoads)

https://i.stack.imgur.com/vaBLy.png

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>NSAppTransportSecurity</key>
    <dict>
      <key>NSExceptionDomains</key>
      <dict>
        <key>www.7timer.info</key>
        <dict>
          <key>NSIncludesSubdomains</key>
          <true/>
          <key>NSExceptionAllowsInsecureHTTPLoads</key>
          <true/>
        </dict>
      </dict>
    </dict>
  </dict>
</plist>

z
zeusstl

For Cordova, if you want to add it into your ios.json, do the following:

"NSAppTransportSecurity": [
   {
      "xml": "<dict><key>NSAllowsArbitraryLoads</key><true /></dict>"
   }
]

And it should be inside of:

"*-Info.plist": {
   "parents": {
   }
}

Just in config.xml didn't work. Not sure if both are necessary, but the ios.json solution sealed the deal for me.
Why is NSAllowsArbitraryLoads set to true? You subvert the purpose of ATS. Also see The most dangerous code in the world: validating SSL certificates in non-browser software. Your software just made the list.
P
Peter Mortensen

Like many have noted, this is a feature issue that comes with iOS 9.0. They have added a thing called App Transport Security, and I too was annoyed when it broke my Apps.

You can bandage it with the NSAllowsArbitraryLoads key to YES under NSAppTransportSecurity dictionary in your .plist file, but ultimately you will need to re-write the code that forms your URLs to form the HTTPS:// prefix.

Apple has re-written the NSUrlConnection class in iOS 9.0. You can read about it in NSURLConnection.

Else, you may have to back out of iOS 9.0 until you have time to implement the correct solution.