DevLog.at

Viewing Single Post (2/2)

iOS only allows https requests. However, I need to test on a server running locally on http.

NSExceptionAllowsInsecureHTTPLoads is the key you need to set to bypass this restriction. Here's the code you need to add to your Xcode project's Info.plist (beware, some of these keys may already exist in your project):

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>localhost</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>

Here it says localhost, but in my case I had add an extra entry for 10.0.0.239 – my laptop's local ip address – since I was testing my app on-device.

28d

0 comments on this post

Sign in with GitHub to comment on this post.