如何解决 TypeError: Network Request Failed for react 项目在 android 设备上运行

时间:2021-07-22 14:33:56

标签: javascript android react-native fetch expo

使用 expo 在 android 设备上运行我的 react native 应用程序时,api 响应没有出现,这是使用 fetch 和 POST 方法完成的,并收到此错误:

[未处理的承诺拒绝:类型错误:网络请求失败] 在 node_modules\whatwg-fetch\dist\fetch.umd.js:535:17 在 setTimeout$argument_0 在 node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 在 _callTimer 在 node_modules\react-native\Libraries\Core\Timers\JSTimers.js:383:16 in callTimers 在 __callFunction 中的 node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 在 __guard$argument_0 中的 node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 在 __guard 中的 node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 在 node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 在 callFunctionReturnFlushedQueue at [native code]:null in callFunctionReturnFlushedQueue

1 个答案:

答案 0 :(得分:0)

您介意分享您为使用 FETCH API 获得响应而处理的 promise 片段吗?