简体   繁体   English

swift - Firebase数据库快照检索。

[英]swift - Firebase database snapshot retrieval.

I have a database structure like below. 我有一个如下所示的数据库结构。 This function below prints out everything in child node 下面的这个函数打印出子节点中的所有内容

func fetchUser() {

    ref.child("Businesses").observe(.childAdded, with: { (snapshot) in

        print(snapshot)

    }, withCancel: nil)
}

But whenever I try to get the same snapshot for BusinessCategories and used the function below nothing happens. 但每当我尝试为BusinessCategories获取相同的快照并使用下面的函数时,没有任何反应。 I have also tried adding .child("Banks") and still no print out and no error message. 我也尝试添加.child(“Banks”),但仍然没有打印出来,也没有错误消息。

func fetchUser() {

  ref.child("BusinessCategories").observe(.childAdded, with: { (snapshot) in

        print(snapshot)

    }, withCancel: nil)
}

What am I doing wrong ? 我究竟做错了什么 ? and how can I get snapshot of BusinessCategories? 以及如何获取BusinessCategories的快照?

在此输入图像描述

The code works fine. 代码工作正常。 The problem was the test user was deleted from the authentication list and the app could not sign in to the database. 问题是测试用户已从身份验证列表中删除,并且应用程序无法登录数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM