问题:
嘿,Stackoverflow。由于互联网问题,我上周仅在网络模拟器中测试了我的 React Native 应用程序。现在我想在 Expo go 移动模拟器中尝试一下。但是,一旦我连接到项目并且 js 完全构建完毕,整个应用程序就会崩溃,并且没有错误消息。
我试图修复它:
我现在将手机连接到 Windows 电脑并运行此 logcat 命令:adb logcat *:S ReactNative:V ReactNativeJS:V以这种方式获取错误消息。但我不知道问题出在哪里。
当我运行应用程序时,logcat 命令会记录以下内容:
10-19 13:54:39.731 9429 11453 I ReactNativeJS: Running "main" with {"initialProps":{"exp":{}},"rootTag":1}
10-19 13:54:39.801 9429 11453 W ReactNativeJS: Constants.installationId has been deprecated in favor of generating and storing your own ID. Implement it using expo-application's androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on the web. This API will be removed in …Run Code Online (Sandbox Code Playgroud) 我遇到的问题是,一旦我想调用我的 firebase 函数,我就会收到 Cors 策略错误。我已经阅读了多个相关问题,但在 Firebase 版本 9 中找不到解决该问题的问题。 v9 中的调用语法有所不同。而且我不知道如何解决它。
错误:
Access to fetch at 'https://us-central1-mmonitor-19efd.cloudfunctions.net/sendRequest' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Run Code Online (Sandbox Code Playgroud)
Firebase 初始化:
import { initializeApp } from 'firebase/app';
import { getFunctions } from 'firebase/functions';
const firebaseConfig …Run Code Online (Sandbox Code Playgroud)