我正在尝试使用 GeoFire 搜索附近的注册位置,如果指定半径内没有,则返回默认值。我的问题是,当 GeoFire 在附近找不到任何东西时,它绝对不会返回任何内容。有不同的方法可以做到这一点吗?
let geoFire = GeoFire(firebaseRef: DataService().LOC_REF)
let myLoc = CLLocation(latitude: 10.500000, longitude: -100.916664)
let circleQuery = geoFire.queryAtLocation(myLoc, withRadius: 100.0)
circleQuery.observeEventType(GFEventType.KeyEntered, withBlock: {
(key: String!, location: CLLocation!) in
self.allKeys[key]=location
print(self.allKeys.count) //NOT GETTING HERE
print(key)
//from here i'd like to use the key for a different query, or determine if there are no keys nearby
}
})
})
提前致谢