messages
-K2ib4H77rj0LYewF7dP
text: "hello"
name: "anonymous"
-K2ib5JHRbbL0NrztUfO
text: "how are you"
name: "anonymous"
-K2ib62mjHh34CAUbide
text: "i am fine"
name: "anonymous"
Firebase数据库:我试图获取文本子项的值。我怎样才能获得所有价值?并将其存储在数组中?
答案 0 :(得分:1)
取决于平台,您可以阅读每个平台here
的文档答案 1 :(得分:0)
好吧,所有邮件都存储在messages
中,所以......使用它!
答案 2 :(得分:0)
试试这个(如果你使用的是Swift) -
let ref = FIRDatabase.database().reference()
ref.child("messages").observeSingleEvent(of: FIRDataEventType.value, with: { (snapshot) in
if let bracketsSnapshot = snapshot.children.allObjects as? [FIRDataSnapshot] {
now you have your array, do something })