Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.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
错误:FIREBASE致命错误:无法分析FIREBASE url。请使用https://<;您的FIREBASE>;。但数据库url不是firebaseio.com_Firebase_React Native_Firebase Realtime Database_Expo_React Native Ios - Fatal编程技术网

错误:FIREBASE致命错误:无法分析FIREBASE url。请使用https://<;您的FIREBASE>;。但数据库url不是firebaseio.com

错误:FIREBASE致命错误:无法分析FIREBASE url。请使用https://<;您的FIREBASE>;。但数据库url不是firebaseio.com,firebase,react-native,firebase-realtime-database,expo,react-native-ios,Firebase,React Native,Firebase Realtime Database,Expo,React Native Ios,我在ios应用程序中使用Expo SDK,当我尝试在firebase数据库中写入数据时,却出现了错误错误:FIREBASE致命错误:无法分析FIREBASE URL。请使用https://.firebaseio.com* 我的firebase配置文件是 const firebaseConfig = { apiKey: "xxxxxx", authDomain: "xxxxxx.firebaseapp.com", databaseURL: &qu

我在ios应用程序中使用Expo SDK,当我尝试在firebase数据库中写入数据时,却出现了错误错误:FIREBASE致命错误:无法分析FIREBASE URL。请使用https://.firebaseio.com*

我的firebase配置文件是

const firebaseConfig = {
  apiKey: "xxxxxx",
  authDomain: "xxxxxx.firebaseapp.com",
  databaseURL: "https://xxxxxxxxxxxxxx.europe-west1.firebasedatabase.app",
  projectId: "xxxxx",
  storageBucket: "xxxxxxx.appspot.com",
  messagingSenderId: "xxxxxxxxx",
  appId: "xxxxxxxxxx",
  measurementId: "xxxxxx"
};

我存储数据的函数是


signUp = () => {
   const user = firebase.auth().currentUser;
   let userid = user.uid;

   firebase
     .database()
     .ref(`users/${userid}`)
     .set({
       firstname: this.state.firstname,
       lastname: this.state.lastname,
       password: this.state.password,
       email: this.state.email,
       dob: this.state.dob,
       postcode: this.state.postcode,
     })
     .then(() => {
       alert("user created");
     })
     .catch((err) => {
       alert("error");
     });
 };
我的数据库规则在读写时设置为true

我尝试了以下数据库URL,但都不起作用

const firebaseConfig = {

  databaseURL: "https://xxxxxxxxxxxxxx.europe-west1.firebaseio.com",
 
};
const firebaseConfig = {

  databaseURL: "https://xxxxxxxxxxxxxx.firebaseio.com",
 
};


正在寻求帮助,请

您是否初始化了配置?像这样的

import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/database';
import 'firebase/auth';
import 'firebase/storage';
import 'firebase/functions';

interface ConfigProps {
    apiKey: string;
    authDomain: string;
    databaseURL: string;
    projectId: string;
    storageBucket: string;
    messagingSenderId: string;
    appId: string;
}

const config: ConfigProps = {
    apiKey: '******************',
    authDomain: '******************',
    databaseURL: '******************',
    projectId: '******************,
    storageBucket: '******************',
    messagingSenderId: '******************',
    appId: '******************',
};

firebase.initializeApp(config);
firebase.firestore();

export default firebase;
这里是消防队

不知何故,世博会似乎将您锁定在2020年2月发布的Firebase SDK上。这比添加
firebasedatabase.app
URL更早,这发生在2020年5月,据我所知,它是以JavaScript SDK版本发布的

当我将SDK依赖项升级到7.14.5时,问题就消失了,尽管Expo Snapshot editor在我升级时显示了一个错误:

{
  "dependencies": {
    "react-native-paper": "3.6.0",
    "expo-constants": "~9.3.1",
    "firebase": "7.14.5"
  }
}

我的建议是升级到最新版本的SDK,如Firebase控制台和文档中的配置片段所示。

Firebase软件包升级到最新版本解决了此问题

"firebase": "^8.2.3"

查看错误消息的确切来源将非常有帮助。但是我建议显式地将URL传递到数据库初始化中:
firebase.database().ref(“https://.firebasedatabase.app“”
作为一种解决方法。@FrankvanPuffelen我试过了,它给我同样的错误是的,我已经初始化了配置,我在app.js
import*中从“firebase”调用它作为firebase;从“/variables/firebase”/”导入firebaseAppconfig在此处提供有效的FIREBASE配置//https://firebase.google.com/docs/web/setup const FIREBASE_CONFIG:any=firebaseAppconfig;尝试{if(FIREBASE_CONFIG.apiKey){FIREBASE.initializeApp(FIREBASE_CONFIG);}}catch(err){//ignore app ready initialized error on snack}
我升级了依赖项,但它仍然给出相同的错误。我的依赖项是“
{@expo/vector icons”:“^12.0.0”,“expo”:“~40.0.0”,“expo常量”:“^9.3.5”,“expo firebase recaptcha”:“^1.3.0”,“expo字体”:“~8.4.0”,“expo链接”:“~2.0.0”,“expo启动屏幕”:~0.8.0”,“expo状态栏”:“~1.0.3”,“expo web浏览器”:“~8.6.0”,“firebase”:“^7.14.5”,“反应”:“16.13.1”,“反应dom”:“16.13.1”,“反应本机”:https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz" }
这很有趣,因为我在这里工作:是的,这很奇怪。我使用的是最新的SDK依赖项,我不确定出了什么问题。我将继续调试itHey@gangataarun。您在这里取得了任何进展吗?鉴于我能够使用Firebase SDK版本复制消息,并能够通过升级到新版本来修复它,我很确信它一定是版本相关的。如果你还没有修好它,你能把它复制成世博会点心,让我看看吗?