小编mar*_*vzc的帖子

React Native Http 请求在 Android 中不起作用

使用FetchAxios处理对服务器的请求,在 Android 模拟器/设备上运行它时,它显示以下错误:

在此输入图像描述

这是请求代码:

fetch(URL,{
      method: 'POST',
      headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
                email: userEmail,
                password: userPassword
            }),

        })
        .then((response) => response.json())
         .then((responseJson)=>{
             Alert.alert("bien");
       console.warn(responseJson);
             })
         .catch((error)=>{
         console.error(error);
     console.warn(error);
   });
Run Code Online (Sandbox Code Playgroud)

react-native

5
推荐指数
2
解决办法
2万
查看次数

标签 统计

react-native ×1