6

Hello Stackoverflow,

I keep getting this error after I moved my swift app onto Swift2.0:

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.
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

And I took a look at the following link https://forums.developer.apple.com/thread/5835

and added the following code to my info.plist

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

And it still doesn't work, anyone have an alternative solution?

5
  • Look at this link @github.com/meteor/meteor/issues/4560 Commented Jul 27, 2015 at 14:28
  • 1
    And this one stackoverflow.com/questions/30731785/…. Commented Jul 27, 2015 at 14:37
  • I tried the second result and it still hasn't worked for me Commented Jul 27, 2015 at 15:10
  • Have you tried just allowing all other connection without the NSExceptionDomains key? <key>NSAppTransportSecurity</key> <dict> <!--Include to allow all connections (DANGER)--> <key>NSAllowsArbitraryLoads</key> <true/> </dict> Commented Jul 27, 2015 at 17:44
  • Yes and that didn't resolve my issue either Commented Jul 27, 2015 at 18:14

1 Answer 1

8

Its not a Swift 2.0 issue its actually an iOS 9.0 issue where iOS 9.0 forces web traffic to go over https setting the below flag allows http traffic.

You have to set the NSAllowsArbitraryLoads key to YES under NSAppTransportSecurity dictionary in your .plist file. Hope this helps!

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Sadly Not working. And it is not ios9 related.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.