Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Transport Security has blocked Parse files... Swift 2 error

I continually get this type of error in my app which uses a Parse.com backend:

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.

I have tried adding the following to my info.plist but it has not worked. No other solutions online have worked. Does anyone know what to do?

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>files.parsetfss.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionsAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>
like image 768
Anthony Saltarelli Avatar asked Aug 12 '15 23:08

Anthony Saltarelli


People also ask

How do I allow HTTP in Swift?

How to allow HTTP URL request for debug schema in Xcode — Swift & SwiftUI. If you need to hit the HTTP request from Xcode and above you need to specify the URL in info. plist file to allow the request. You can allow all the http request by adding arbitrary load to “YES” in info.

What is Nsallowsarbitraryloads?

A Boolean value indicating whether App Transport Security restrictions are disabled for all network connections.

What is App transport security iOS?

App Transport Security (ATS) is a privacy feature introduced in iOS 9. It's enabled by default for new apps and enforces secure connections.


1 Answers

This plist entry is working for me -

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>files.parsetfss.com</key>
            <dict>
                <key>NSIncludeSubdomains</key>
                <true/>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>

You have the key NSIncludesSubdomains rather than NSIncludeSubdomains - an extra s between 'Include' and 'Subdomains'

like image 159
Paulw11 Avatar answered Nov 15 '22 08:11

Paulw11