Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/107.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native IOS:axios/fetch请求被卡住,仅在IOS上没有错误或响应_Ios_React Native_Axios_Fetch - Fatal编程技术网

React native IOS:axios/fetch请求被卡住,仅在IOS上没有错误或响应

React native IOS:axios/fetch请求被卡住,仅在IOS上没有错误或响应,ios,react-native,axios,fetch,Ios,React Native,Axios,Fetch,说明: 在IOS中使用Axios或fetch发送请求不起作用,API是HTTPS还是HTTP也无关紧要 没有错误到达捕获或没有收到响应 也没有错误,只有警告 2020-02-18 21:31:21.096 [warn][tid:com.facebook.react.NetworkingQueue][RCTEventEmitter.m:53] Sending `didReceiveNetworkResponse` with no listeners registered. 2020-02-18 2

说明:

在IOS中使用Axios或fetch发送请求不起作用,API是HTTPS还是HTTP也无关紧要 没有错误到达捕获或没有收到响应 也没有错误,只有警告

2020-02-18 21:31:21.096 [warn][tid:com.facebook.react.NetworkingQueue][RCTEventEmitter.m:53] Sending `didReceiveNetworkResponse` with no listeners registered.
2020-02-18 21:31:21.100 [warn][tid:com.facebook.react.NetworkingQueue][RCTEventEmitter.m:53] Sending `didReceiveNetworkData` with no listeners registered.
2020-02-18 21:31:21.100 [warn][tid:com.facebook.react.NetworkingQueue][RCTEventEmitter.m:53] Sending `didCompleteNetworkResponse` with no listeners registered.
这只发生在IOS上,android运行良好

反应本机版本:

System:
    OS: macOS 10.15.3
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 40.29 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.15.0 - /usr/local/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.13.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5977832
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.12.0 => 16.12.0
    react-native: 0.61.5 => 0.61.5
  npmGlobalPackages:
    react-native-cli: 2.0.1
复制步骤
  • 只需向任何API发送任何请求 二,
  • 预期结果 从API中获取结果甚至错误

    零食、代码示例、屏幕截图或到存储库的链接: 应用程序卡在这里,因为我正在等待请求的结果或错误

    我的简单函数

    export const checkAuth = (accessToken) => async (dispatch, getState) => {
      try {
        const response = await fetch('https://www.google.com', {
          method: 'GET',
          headers: {
            // Accept: 'application/json',
            // Authorization: `Bearer ${accessToken}`,
          },
        })
        const json = await response.json()
        const { error } = json
    
        if (error) {
          return false
        }
        return true
      }
      catch (error) {
        return false
      }
    }
    
    我的信息列表