firebase观察者快照部分数据

时间:2016-03-22 13:35:34

标签: swift firebase observers

我有一个项目列表和一个观察者,假设在添加项目时更新该列表(使用观察者(childAdded))

screenShot of my DB + Snapshot in Xcode

当在firebase中的ref创建此项时,我可以在DB中看到所有这些项。

(在我的屏幕截图中,-KDSPrkNZVGbhrg2JOEe项目已存在且我正在添加KDTIER7vD4J2C_Y350V项目)

但是在我从观察者那里得到的快照(我的屏幕截图左侧)中,所有参与者节点对象都没有出现,就像我从快照中获得的第一级孩子一样

我做错了什么?观察者是否有可能在数据库中创建所有数据之前制作快照?

这是我的JSON文件

{
  "d4db8fd9-7d90-4125-860f-eafd38f53926" : {
    "-KDSMZ3_puh_KezRwzVx" : {
      "name" : "test 1",
      "numOfParticipants" : 4,
      "participants" : {
        "0525515345" : {
          "lastName" : "Korach",
          "name" : "Yonathan",
          "phoneNumber" : "0525515345"
        },
        "0542824847" : {
          "lastName" : "Ben Attar",
          "name" : "Ofer",
          "phoneNumber" : "0542824847"
        },
        "0587006381" : {
          "lastName" : "Brami",
          "name" : "Auriel",
          "phoneNumber" : "0587006381"
        }
      },
      "photo" : "",
      "place" : "Meatos",
      "time" : "2016-03-23 08:00:20 +0000"
    },
    "-KDSPrkNZVGbhrg2JOEe" : {
      "name" : "test 2",
      "numOfParticipants" : 2,
      "participants" : {
        "0525515345" : {
          "lastName" : "Korach",
          "name" : "Yonathan",
          "phoneNumber" : "0525515345"
        }
      },
      "photo" : "",
      "place" : "Dizzy Bar",
      "time" : "2016-03-24 08:15:54 +0000"
    },
    "-KDTIER7vD4J2C_Y350V » : {
      "name" : "test3",
      "numOfParticipants" : 2,
      "participants" : {
        "0587006381" : {
          "lastName" : "Brami",
          "name" : "Auriel",
          "phoneNumber" : "0587006381"
        }
      },
      "photo" : "",
      "place" : "Agadir Burger",
      "time" : "2016-03-25 12:00:16 +0000"
    }
  }
}

0 个答案:

没有答案