网络请求无法响应本机博览会 [英] Network request failed in react native expo

查看:66
本文介绍了网络请求无法响应本机博览会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在expo native中使用expo即时通讯.将数据发布到api laravel时出现问题.它说网络请求失败".这是我的代码:

im using expo in react native.i have a problem when post data to api laravel.its say"Network Request Failed".heres my code:

我希望您能帮助我,谢谢您.在此处输入图片描述

i hope you can help me guys thankyou.enter image description here

推荐答案

我看到您的 fetch URL 是使用HTTP端点提供的.您只能从本机项目向HTTPS端点发出请求.

I see that your fetch URL is served using an HTTP endpoint. You can only make requests to HTTPS endpoints from react-native projects.

可能的解决方法是使用ngrok.只需下载并运行:

A possible workaround is to use ngrok. Just download it and run:

./ngrok http 8000

因为您的端口号是8000.它将公开一个HTTPS终结点,并用该链接替换您的 fetch URL ,然后尝试再次获取数据

Since your port number is 8000. It will expose an HTTPS endpoint and replace your fetch URL with that link and try fetching the data again

这篇关于网络请求无法响应本机博览会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆