react-native - 我的 native 应用程序在从我的服务器错误 : "type error :Network Request Failed " 获取数据时显示错误

标签 react-native ssl https fetch

它在 android 模拟器中工作正常但在设备中不工作。

componentDidMount() {

return fetch('http://ABCD.in/App/TermJSON.jsp')
  .then((response) => response.json())
  .then((responseJson) => {
    console.log(responseJson);
    this.setState({
      dataSource: responseJson.feeList,
      isLoading: false
    }, function () { }
    );

  }).catch((error) => {
    console.log(error);
    alert(error);
  })

}//组合

最佳答案

对于 android,在 AndroidManifest.xml 文件中使用 android:usesCleartextTraffic="true"

对于较新的 android 版本,默认情况下它是禁用的

关于react-native - 我的 native 应用程序在从我的服务器错误 : "type error :Network Request Failed " 获取数据时显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57870436/

相关文章:

react-native - 如何提高 React Native 应用程序的性能

ssl - 如何使用 SSL 来确保服务器身份?

java - 使用自签名证书 : hostName not verified 的 Android Https 连接

java - 使用 JSch 的 SSH 内部的 HTTPS 隧道

database - 具有反应 native 的 Realm

react-native - react native :Dropdown is overlapping with the below content in ios

javascript - react native : How to properly disable touchable feedback when performing swiping gestures?

ssl - 关于代理中间人攻击

node.js - Heroku 上的 HTTPS + SSL - Node + Express

python ssl错误违反协议(protocol)