如何在Firebase数据库中进行查询以获取控制台中的某些子项?例如,从下面的快照中,我怎样才能查询得到Image
,其中Des: 11
。如何使Firebase数据库查询获得一些使用Swift 3的孩子?
我使用这个代码:
func loadData(){
Ref=FIRDatabase.database().reference().child("Posts")
Handle = Ref?.queryOrdered(byChild: "11").observe(.childAdded ,with: { (snapshot) in
if let post = snapshot.value as? [String : AnyObject] {
let img = Posts()
img.setValuesForKeys(post)
self.myarray.append(img)
self.tableView.reloadData()
}
})
}
'ref?.queryOrdered(byChild:“Des”)。queryEqual(toValue:“11” AnyObject] { // .... } })' –
感谢您的帮助,但是这个错误出现在调试中(使用未指定的索引,请考虑在/ posts到您的安全规则中添加“.indexOn”:“Des”为更好的性能) –
这是不是一个错误..它建议你改变你的规则更好的性能..但仍然你的项目与此警告 –