Использование неуказанного индекса. Попробуйте добавить ".indexOn": "g"
Я использую Geofire для выполнения кругового запроса в определенной области. Когда мои наблюдатели настроены, я получаю обратно местоположения, однако, с местоположением я также получаю сообщение "Использование неопределенного индекса. Попробуйте добавить".indexOn": "g""
Моя БД для моего geofire выглядит так: karmadots/geofire/{events}
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
"$events": {
".indexOn": ["g"]
}
}
}
Я также попробовал:
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
".indexOn": ["g"]
}
}
}
Оба не делают сообщение уйти. Есть ли что-то еще, что я могу попробовать прочитать или попробовать в качестве примера?
Спасибо за помощь.
РЕДАКТИРОВАТЬ:
Мой путь - xxxxx.firebaseio.com/karmadots/geofire/ enjkeys}
Вот как я запрашиваю:
func setupListeners(query: GFQuery){
// Event is in initial area or entered area
query.observeEventType(GFEventTypeKeyEntered, withBlock: { (key: String!, location: CLLocation!) in
println("Key '\(key)' entered the search area and is at location '\(location)'\n")
})
// Event left area
query.observeEventType(GFEventTypeKeyExited, withBlock: { (key: String!, location: CLLocation!) in
println("Key '\(key)' left the search area\n")
})
// Event moved but is still in area
query.observeEventType(GFEventTypeKeyMoved, withBlock: { (key: String!, location: CLLocation!) in
println("Key '\(key)' moved in the search area and is at location '\(location)'\n")
})
}
1 ответ
Решение
Снятие скобок вокруг ["g"] решает проблему. Вот последний кусок кода:
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
".indexOn": "g"
}
}
}