Hi community,
I'm new to iOS development and I can't seem to get GeoFire working correctly. I read through the documentation but I can't seem to understand it correctly.
My app constantly monitors the user's location with CLLocation (I got that working correctly, the app is displaying the correct latitude and longitude information), and I have 2 locations in my database that is near the latitude/longitude. These two locations' latitude/longitude information is fed in from GeoFire setLocation() method and I can do that successfully too. My issue is I can't get queryAtLocation working correctly. I believe it has something to do with my data structure on Firebase, this is how it looks like (I faked the hash and latitude/longitude information here):
my_iOS_app:
post:
-K141KJSLF (first unique post IDs created by Firebase childByAutoID )
-coordinates
-g: "098salfj" (unique hash created by GeoFire)
-l
-0: 15.931309 (latitude populated by GeoFire)
-1: 100.131234 (longitude populated by GeoFire)
-K130AFE (first unique post IDs created by Firebase childByAutoID )
-coordinates
-g: "9had89j" (unique hash created by GeoFire)
-l
-0: 15.9413 (latitude populated by GeoFire)
-1: 100.14131 (longitude populated by GeoFire)
So the GeoFire reference is GeoFire(firebaseRef: my_iOS_app/post). When I do the queryAtLocation with center coordinates very close to those two posts' coordinates, the query_handle is not returning anything. Is it because my firebaseRef is pointing at "post"? Is it because the GeoFire hash/coordinate information is embedded two layers below the GeoFire firebaseRef?
In the GeoFire example with the bar reviews, I think they also embed their coordinates 1-2 layers below the Firebase reference too...Any know what I did wrong? Thank you in advance!