响应本机博览会客户端的网络请求失败 [英] network request failed in react native expo client
本文介绍了响应本机博览会客户端的网络请求失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
网络请求失败
我试过允许端口连接通过 sudo ufw 允许任何端口命令,但它没有帮助
I have tried allowing port to connect by sudo ufw allow to any port command but it is not helping
fetch('http://192.XXXXXX//form/user_registration.php',
{
method: 'POST',
headers:
{
'Accept': 'application/json',
'Content-Type': 'application/json',
},
网络请求失败
堆栈跟踪:
node_modules/react-native/Libraries/vendor/core/whatwg-fetch.js:504:29 in onerror
node_modules/event-target-shim/lib/event-target.js:172:43 in dispatchEvent
node_modules/react-native/Libraries/Network/XMLHttpRequest.js:580:29 in setReadyState
node_modules/react-native/Libraries/Network/XMLHttpRequest.js:394:25 in __didCompleteResponse
node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js:190:12 in emit
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:366:47 in __callFunction
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:106:26 in <unknown>
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:314:10 in __guard
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:105:17 in callFunctionReturnFlushedQueue
...
推荐答案
我通过在我的电脑和手机上使用相同的连接解决了这个问题在usb tathering的帮助下,我在两边得到了相同的ip,而且我也必须更改我的端口号,因为两个本地服务器不会相互冲突...
i solved this by having a same connection on my pc as well as my phone with the help of usb tathering i got the same ip on both the sides, also i have to change my port number too due to that both local servers will not conflict with each other...
这篇关于响应本机博览会客户端的网络请求失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文