To allow unsecure HTTP request from Swift code by URLSession here are the settings visually:

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>
				
			
Transport security has blocked HTTP request

Leave a Reply

Your email address will not be published. Required fields are marked *