jose compaq
jose compaq

Reputation: 51

How to disable NSAppTransportSecurity in my info.plist file?

How to disable NSAppTransportSecurity in my info.plist file?

that is my request

func request(){     
            let url = NSURL(string: "https://www.widadclub.tk/feed/")
            let feedParser = MWFeedParser(feedURL: url)
            feedParser.delegate = self
            feedParser.parse()        
    }

Upvotes: 3

Views: 2260

Answers (2)

J.Williams
J.Williams

Reputation: 1425

To disable totally NSAppTransportSecurity for ALL domains open the plist file with a text editor and add:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <!-- .......................... -->
        <!-- Other keys already present -->
        <!-- .......................... -->

        <key>NSAppTransportSecurity</key>
        <dict>

           <key>NSAllowsArbitraryLoads</key>
           <true/>

        </dict>

    </dict>
    </plist>

To add specific exceptions to a list of domains add this instead:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <!-- .......................... -->
    <!-- Other keys already present -->
    <!-- .......................... -->

    <key>NSAppTransportSecurity</key>
    <dict>

        <key>NSExceptionDomains</key>
        <dict> 

            <key>widadclub.tk</key>
            <dict>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSIncludesSubdomains</key>
                <true/>
            </dict>

        </dict>
    </dict>

</dict>
</plist>

NSIncludesSubdomains is not necessary but permits to access subdomains like wiki.widadclub.tk, blog.widadclub.tk etc.

For a detailed tutorial have a look at this blog post

Upvotes: 3

Manav Gabhawala
Manav Gabhawala

Reputation: 997

You can add exceptions to the Info.plist file. Here's what the final dictionary should look like. Note: I added all the exceptions available to you, pick and choose whatever applies to you. For instance, if you don't need a minimum TLS version of 1.1 don't include that key. In the current beta the keys don't have auto completion in the info.plist so I added the strings to the bottom for convenience of copy pasting. Info.plist file

NSAppTransportSecurity
NSExceptionDomains
NSIncludesSubdomains
NSTemporaryExceptionAllowsInsecureHTTPLoads   
NSTemporaryExceptionMinimumTLSVersion
NSTemporaryExceptionRequiresForwardSecrecy

Upvotes: 2

Related Questions