Abhishek
Abhishek

Reputation: 1714

Image Source URIs with HTTPS (SSL) Work, HTTP do NOT Work (React Native v0.30.0)

In React-Native version 30 certain images are not loading.

this is working

<Image style={styles.messageImage} 
       source={{uri:'https://facebook.github.io/react/img/logo_og.png'}}/>

This doesn't work

<Image style={styles.messageImage} 
       source={{uri:'http://i.imgur.com/lDz3wVn.png'}}/>

Looks like images with https link are working while those with http link are not working. Is anyone else facing this issue?

Thanks.

Upvotes: 3

Views: 4383

Answers (1)

Aakash Sigdel
Aakash Sigdel

Reputation: 9300

  1. open ios/YourProject.xcodeproj in xcode
  2. open info.plist as Property List
  3. Right click on App Transport Security Settings > Add Row
  4. Add Allow Arbitrary Loads Boolean and set it to Yes
  5. rebuild your app.

enter image description here

Xcode by default blocks all the http request and only allows https request. Because it is the right thing to do.

Here is a blog post about App Transport Security: https://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/

Upvotes: 16

Related Questions