尝试使用http移植一个基于一堆节点模块的应用程序。
除了为fetch重写库之外,还有其他解决方案吗
发布于 2017-06-06 11:54:47
http只是iOS 9+上的一个问题。您可以只允许这样的http - React Native fetch() Network Request Failed
这里是文档中提到的地方- http://facebook.github.io/react-native/releases/0.44/docs/running-on-device.html#app-transport-security
在这里转到您的info.plist文件:/Users/Noitidart/Documents/YOUR_PROJECT_NAME/ios/YOUR_PROJ_NAME/Info.plist
然后找到NSExceptionDomains。您将看到localhost已经在那里了。您可以在此处添加其他域名。下面是允许bing作为http:
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>bing.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>您可以通过设置以下内容来允许所有http:
<key>NSAllowsArbitraryLoads</key>
<true/>每个https://stackoverflow.com/a/38427829/1828637
在安卓系统上,http不是问题。
https://stackoverflow.com/questions/44377498
复制相似问题