我在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)
})
代碼數據庫的圖像如何
我改變我的角色那樣,但我仍然不能讀也沒有錯誤顯示在我的控制檯 –
它不工作 –
相同的問題不是親愛的工作 –