React native 在react native上获取错误网络,但正在使用postman
我目前正在开发一个react原生应用程序。正在处理登录部分, 我成功地用正确的返回值向邮递员发出了呼叫,但当通过react原生android客户端获取时,我在调用heroku服务器时完全没有返回,甚至在本地运行服务器时出现网络故障错误 我做错了什么?我完全没有从下面的代码中得到任何日志React native 在react native上获取错误网络,但正在使用postman,react-native,heroku,fetch,postman,React Native,Heroku,Fetch,Postman,我目前正在开发一个react原生应用程序。正在处理登录部分, 我成功地用正确的返回值向邮递员发出了呼叫,但当通过react原生android客户端获取时,我在调用heroku服务器时完全没有返回,甚至在本地运行服务器时出现网络故障错误 我做错了什么?我完全没有从下面的代码中得到任何日志 const payloadJson = JSON.stringify({ email: 'julien@hypecode.com', password: 'password', }
const payloadJson = JSON.stringify({
email: 'julien@hypecode.com',
password: 'password',
})
fetch('https://alsatoju-dev.herokuapp.com/login', {
method: 'POST',
body: payloadJson,
headers: {
Accept: '*/*',
'Content-Type': 'application/json',
},
}).then((response) => {
console.log(response)
return response.json()
})
.then((res) => console.log(res))
.catch((err) => console.log(err))
您可以从手机浏览器发出http请求吗?如果你做不到,那就意味着你的连接出现了问题。@ridvanaltun是的,看起来是这样的。我试着做了一个blitzstack,效果很好……但我甚至无法在我的模拟器上启动google chrome:/