我在swift中使用firebase从Firebase实时数据库读取一些数据。当我在火力面板有一个项目它的做工精细,但添加另一个项目后,今天我得到了错误这样firebase错误考虑添加“.indexOn”:
2017年9月23日00:15:18.360 AfgDate [2816] [火力地堡/数据库] [我-RDB034028]使用未指定的索引。您的数据将在客户端下载并过滤。考虑加入“.indexOn”:‘日期’,在/数据安全规则获得更好的性能
这是我的数据库结构
我的角色是
{
"rules": {
".read": true,
".write": true,
}
}
,我以后改变了我的角色,这一个
{
"rules": {
"data": {
".indexOn": "date",
".read": true,
".write": true
}
}
}
在这个时候还我不能读取数据,并和我没有看到任何错误控制台 这是我在迅速
ref = Database.database().reference()
ref.child("data").queryOrdered(byChild: "date").queryEqual(toValue: "1396/06/05").observeSingleEvent(of: .value, with: { (snapShot) in
if let snapDict = snapShot.value as? [String:AnyObject]{
for each in snapDict{
let key = each.key as String
let date = each.value["date"] as!String
let name = each.value["text"] as! String
print(key)
print(name)
self.lblshow.text = name
}
}
}, withCancel: {(Err) in
print(Err.localizedDescription)
})
代码数据库的图像如何
我改变我的角色那样,但我仍然不能读也没有错误显示在我的控制台 –
它不工作 –
相同的问题不是亲爱的工作 –