react-native - TypeError:网络请求失败。安卓
问题描述
使用 http:// 请求获取错误并且使用 https:// 其工作正常
例如
getData(){
fetch('http://facebook.github.io/react-native/movies.json', {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
}
})
.then((response) => response.json())
.then((responseJson) => {
console.log('responseJson >>>>'+JSON.stringify(responseJson));
})
.catch((error) => {
console.error('error>>>>>'+error);
});
}
反应版本“反应”:“16.6.3”,“反应原生”:“0.58.5”
** 设备有网络连接,因为设备浏览器网页正在加载。
解决方案
推荐阅读
- python - 用条件填充缺失值
- html - 无法将消息提示到反应式表单中的必填字段
- python - 对大量文档进行重复数据删除 (Python)
- active-directory - 从 AD 用户和属性在数组中创建报表,并允许属性为空
- python - 基于 pca.explained_variance_ratio_ plot 的累积解释方差似乎太多
- python - 格式化不带小数的货币值
- google-cloud-platform - 从 Azure blob 复制到 GCP 存储桶 - 通过 Terraform
- javascript - 有没有办法调用嵌套在另一个函数中的函数?
- vue.js - Vue.js 组件删除同级标记。特征?
- react-native - 点击时反应原生移除不透明度