它在 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/