【发布时间】:2017-05-29 19:19:18
【问题描述】:
我使用 Firebase 作为我的 IOS 应用程序的数据库。我想从数据库中检索多个用户的数据。
这是我的数据库组织:
-
用户
- 用户 ID1
- 位置:value1
- 用户 ID2
- 位置:值2
- 用户 ID1
...
我想检索数据库所有用户的位置数据。
基本快照功能
ref.child("Users").child("").child("Location").observe(.value, with: {
snapshot in
for Location in snapshot.children {
self.locationsArray.append((Location as AnyObject).key)
}
print(self.locationsArray)
})
我的问题是:即使我之前没有指定(我不能)作为孩子姓名的用户 ID,我如何检索所有 Locations?谢谢。
【问题讨论】:
标签: swift xcode firebase firebase-realtime-database