React Native App Transport Security 已阻止 [英] React Native App Transport Security has blocked

查看:43
本文介绍了React Native App Transport Security 已阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了 react-native-image-crop.当我试图在真正的 iPhone 上拍照时,我收到了一个非常奇怪的错误.'App Transport Security 已阻止明文 HTTP (http://) 资源加载,因为它不安全.可以通过应用程序的 Info.plist 文件配置临时例外.'.这是因为我使用地铁建设者吗?或者别的什么?

I just installed react-native-image-crop. When I tried to make a photo on an actual iPhone, I received a quite strange error. 'App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.'. Is this because I using the metro builder? or something else maybe?

我的信息.plist:

My Info.plist:

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

推荐答案

需要在Info.plist中添加这个key

You need to add this key in Info.plist

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

这篇关于React Native App Transport Security 已阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆