Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactNative踩坑-fetch请求本地起的node服务报Network Request Failed #6

Open
rico-c opened this issue Nov 3, 2018 · 0 comments

Comments

@rico-c
Copy link
Owner

rico-c commented Nov 3, 2018

fetch请求本地起的node服务报Network Request Failed

android模拟器(simulator)把它自己作为了localhost,也就是说,代码中使用localhost或者127.0.0.1来访问,都是访问模拟器自己,这是不行的

解决

如果你想在模拟器simulator上面访问你的电脑,那么就使用android内置的IP 10.0.2.2 吧, 10.0.2.2 是模拟器设置的特定ip,是你的电脑的别名alias记住,在模拟器上用10.0.2.2访问你的电脑本机.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant