React Native App Transport Security has blocked

老子叫甜甜 提交于 2020-08-26 06:57:46

问题


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?

My Info.plist:

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

回答1:


You need to add this key in Info.plist

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


来源:https://stackoverflow.com/questions/51363339/react-native-app-transport-security-has-blocked

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!