React Native iOS模拟器中网络图片无法加载

huangapple go评论80阅读模式
英文:

React Native iOS simulator network images not loading

问题

我有一个用React Native创建的应用程序。图像资产和react-native-vector-icons加载正确。但是网络图像无法加载。图像是从aws获取的带有签名的URL。这些链接在安卓上工作正常。

尝试了这个修复方法 - https://github.com/facebook/react-native/issues/29279#issuecomment-658244428

我认为不需要补丁修复 https://github.com/facebook/react-native/issues/29279#issuecomment-657284028 因为我的 react-native 版本是 0.70.1

应用程序信息

"react-native": "0.70.1"
Xcode 版本 13.2.1 (13C100)
英文:

I have a react native app created. Image assets and react-native-vector-icons are loading correctly. But network images are not loading. Images are being fetched from aws as signed url. Those links are working correctly on android.

Tried this fix - https://github.com/facebook/react-native/issues/29279#issuecomment-658244428

I don't think the patch fix is required https://github.com/facebook/react-native/issues/29279#issuecomment-657284028 as my react-native version is 0.70.1

App Information

"react-native": "0.70.1"
Xcode Version 13.2.1 (13C100)

答案1

得分: 1

好的,以下是翻译好的部分:

"ok. the URL you shared is http and iOS does not all http request. to allow http request in iOS please add this to info.plist file"

"好的。您分享的URL是http协议,而iOS不允许所有的http请求。要在iOS中允许http请求,请将以下内容添加到 info.plist 文件中:"

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

"for more details please see this question and answer"

"要了解更多详细信息,请参考这个问题和答案"

英文:

ok. the URL you shared is http and iOS does not all http request. to allow http request in iOS please add this to info.plist file

&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
&lt;dict&gt;
    &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt;
    &lt;true/&gt;
&lt;/dict&gt;

for more details please see this question and answer

huangapple
  • 本文由 发表于 2023年2月8日 11:53:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/75381222.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定