Ответ 1
Удаление скобок вокруг [ "g" ] устраняет проблему. Вот заключительная часть кода:
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
".indexOn": "g"
}
}
}
Я использую Geofire для создания roundQuery в определенной области. Однако, когда мои наблюдатели настроены, я возвращаюсь к местам, но с местоположением я также возвращаю "Использование неопределенного индекса". Рассмотрим добавление ".indexOn": "g" "
Мой db для моего геофина похож на этот karmadots/geofire/{events}
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
"$events": {
".indexOn": ["g"]
}
}
}
Я также пробовал:
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
".indexOn": ["g"]
}
}
}
Оба сообщения не уходят. Есть ли что-то еще, что я могу попробовать прочитать или попробовать в качестве примера?
Спасибо за помощь.
EDIT:
Мой путь: xxxxx.firebaseio.com/karmadots/geofire/{keys}
Вот как я запрашиваю:
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")
})
}
Удаление скобок вокруг [ "g" ] устраняет проблему. Вот заключительная часть кода:
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
".indexOn": "g"
}
}
}