我正在尝试按位置获取帖子,并使用firebase和geofire用帖子填充我的收藏夹视图。但是目前我还没有输入键值。我也在物理设备上尝试过,但没有成功。
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let userLocation:CLLocation = locations[0]
guard let uid = Auth.auth().currentUser?.uid else { return }
let rootRef = Database.database().reference()
let geoRef = GeoFire(firebaseRef: rootRef.child("posts"))
let query = geoRef.query(at: userLocation, withRadius: 1000)
query.observe(.keyEntered, with: { key, location in
print("Key: " + key + "entered the search radius.")
})
}