Skip to content

Instantly share code, notes, and snippets.

@hungdev
Last active July 17, 2018 03:28
Show Gist options
  • Select an option

  • Save hungdev/5b7c66a9f5ca5efe05bf9d6314e6f619 to your computer and use it in GitHub Desktop.

Select an option

Save hungdev/5b7c66a9f5ca5efe05bf9d6314e6f619 to your computer and use it in GitHub Desktop.
IOS not request http

issue: facebook/react-native#4415

https://stackoverflow.com/questions/38587451/image-source-uris-with-https-ssl-work-http-do-not-work-react-native-v0-30-0/38587838?noredirect=1#comment64565216_38587838

https://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/

https://stackoverflow.com/questions/43277059/fetch-doesnt-work-in-react-native-ios

In case someone else needs it. I solved it by adding

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

to a Info.plist file which is located inside ios folder in your project.

Thus I changed

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

with

<key>NSAppTransportSecurity</key>
    <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/>
      <key>NSExceptionDomains</key>
      <dict>
        <key>localhost</key>
        <dict>
          <key>NSExceptionAllowsInsecureHTTPLoads</key>
          <true/>
        </dict>
      </dict>
    </dict>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment