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

iRonin IT Team - Experts in software development

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!

Author's Bio
iRonin IT Team

Experts in software development

We are a 100% remote team of software development experts, providing web & mobile application development and DevOps services for international clients.

Similar articles
Comments

Bulletproof your development with remote team augmentation

Read how
This page is best viewed in portrait mode
Our websites and web services use cookies. We use cookies and collected data to enhance your experience, provide additional communication channels, improve marketing materials and enhance our offer. IRONIN SP. Z O.O. SP. K. is committed to protecting all the data that we collect or process in any way, especially data of personal nature. By accepting these terms you agree to our usage of cookies and processing your data, according to our Privacy Policy, and you declare that your browser settings reflect your preferences. Read more You have the right to revoke this agreement at any time, based on the terms of our Privacy Policy. You can change cookies settings in your browser. If you do not agree with us using cookies and processing your data, please change your cookies settings in your web browser and reject these terms. You can find more information about cookies, your data privacy This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies. data processing, and your rights in our Privacy Policy.