我正在使用Geofire在某个区域执行circleQuery。通过设置我的观察者,我返回了位置,但是,位置也返回了一个“使用未指定的索引。请考虑添加".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/{key}
我是这样查询的:
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")
})
}
发布于 2015-01-26 07:25:16
删除"g“周围的括号可以解决这个问题。下面是最后一段代码:
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
".indexOn": "g"
}
}
}
https://stackoverflow.com/questions/28060069
复制相似问题