See all articles
How to enable HTTP traffic from an iOS app - Developers’ Notes

How to enable HTTP traffic from an iOS app - Developers’ Notes

When testing your mobile app while the API server runs locally, remember that Apple has a strict security policy and might block your connection. Luckily, there’s a way to enable it.

Today, we’d like to share a find that occured during a test of one of our iOS apps with the API server running locally. When we updated the URL in the project configuration we got an error: `Could not connect to the server`.

It turned out that Apple is very strict about connections made from the iOS app and it does not allow for unsecured connections by default.

In order to enable it, you need to open the `Info.plist` file and add:

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

You can either do that by opening the file as source code or in the GUI:

After this simple change, the app was able to connect to our local API server without any errors.

Enjoy today’s Developers’ Notes, courtesy of Łukasz, Software Development Team Leader. More will be coming soon!