Android 网络请求失败
我对fetch()api有问题,我使用get方法+https,在Android 9中不起作用。在安卓系统中,7起作用 代码:Android 网络请求失败,android,react-native,fetch,Android,React Native,Fetch,我对fetch()api有问题,我使用get方法+https,在Android 9中不起作用。在安卓系统中,7起作用 代码: fetch('https://facebook.github.io/react-native/movies.json') .然后(功能(响应){ 返回response.json(); }) .then(函数(myJson){ 警报(JSON.stringify(myJson)); }) .catch(函数(错误){ 警报(错误); }); 屏幕: 启动android 9
fetch('https://facebook.github.io/react-native/movies.json')
.然后(功能(响应){
返回response.json();
})
.then(函数(myJson){
警报(JSON.stringify(myJson));
})
.catch(函数(错误){
警报(错误);
});
屏幕:
启动android 9时,您必须手动声明您的应用程序可以向哪个url发出请求 如果您希望快速修复并打开所有url的应用程序,只需在您的清单中添加:
<application
android:usesCleartextTraffic="true"
...
>
什么都没有改变。我不是说你原来的错误是什么?您在错误响应中看到了什么?您是否厌倦了我的解决方案?成功了吗?