由于地区的原因,Firebase 想让我更改我的数据库网址 [英] Firebase wants me to change my database url due to region

查看:31
本文介绍了由于地区的原因,Firebase 想让我更改我的数据库网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误信息如下:

原因:数据库位于不同的区域.请将您的数据库 URL 更改为与我的数据库指示的 URL 相同.

当我尝试在 Firebase 的实时数据库中导入一些数据时,此错误一直显示.这表明我需要更改数据库的URL,因为数据库在另一个区域.

应用程序要我更改的 url 与我的数据库的 url 相同.所以似乎没有问题.

那么我需要以编程方式更改数据库的 url 吗?如果是这样,我该怎么做?

谢谢.

解决方案

您只需要在 ref 中手动添加数据库 URL.

<块引用>

对于 us-central1 默认数据库,您可以不带参数调用 database()(或 database).要获取对 us-central1 默认数据库以外的数据库的引用,必须将数据库 URL 传递给 database()

let ref = Database.database("https://<databaseName><region>.firebasedatabase.app")

您可以在

新数据库的数据库URL也会在创建时显示(虽然默认URL是在Config中添加的).

The error message is as below:

Reason: Database lives in a different region. Please change your database URL to Same URL as my database indicates.

While I'm trying to import some data on my Realtime DataBase of Firebase, This error keep showing. Which indicates that I need to change the URL of database because database is in another region.

The url that the app wants me to change is the same as the url of my database. So there seems to be no problem.

So do I need to change the url of database programmatically? If so how can I do that?

Thanks.

解决方案

You just need to manually add the database URL in the ref.

For a us-central1 default database, you can call database() (or database) without argument. To get a reference to a database other than a us-central1 default database, you must pass the database URL to database()

let ref = Database.database("https://<databaseName><region>.firebasedatabase.app")

You can read more about Relatime Database Locations here.

The database URL of new database is shown while creating it as well (although the default URL is added in the Config).

这篇关于由于地区的原因,Firebase 想让我更改我的数据库网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆