使用HTTPS(SSL)工作的图像源URI,HTTP不起作用(React Native v0.30.0) [英] Image Source URIs with HTTPS (SSL) Work, HTTP do NOT Work (React Native v0.30.0)
问题描述
在React-Native版本30中,某些图像未加载。
In React-Native version 30 certain images are not loading.
这是有效的
<Image style={styles.messageImage}
source={{uri:'https://facebook.github.io/react/img/logo_og.png'}}/>
这不起作用
<Image style={styles.messageImage}
source={{uri:'http://i.imgur.com/lDz3wVn.png'}}/>
看起来带有 https
链接的图片正在运行而那些 http
链接不起作用。还有其他人面临这个问题吗?
Looks like images with https
link are working while those with http
link are not working. Is anyone else facing this issue?
谢谢。
推荐答案
- 打开xos中的ios / YourProject.xcodeproj
- 打开info.plist作为属性列表
- 右键单击App Transport Security Settings> Add Row
- 添加
允许任意加载
布尔值
并将其设置为是
- 重建你的应用。
- open ios/YourProject.xcodeproj in xcode
- open info.plist as Property List
- Right click on App Transport Security Settings > Add Row
- Add
Allow Arbitrary Loads
Boolean
and set it toYes
- rebuild your app.
Xcode默认阻止所有http请求,只允许https请求。因为这是正确的做法。
Xcode by default blocks all the http request and only allows https request. Because it is the right thing to do.
这是一篇关于App Transport Security的博文:https://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx -10-11 /
Here is a blog post about App Transport Security: https://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/
这篇关于使用HTTPS(SSL)工作的图像源URI,HTTP不起作用(React Native v0.30.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!