firebase / geofire-objc

GeoFire for Objective-C - Realtime location queries with Firebase
MIT License
436 stars 179 forks source link

GeoFire Query Gives Only Own Location #123

Open SamaritanMachine opened 5 years ago

SamaritanMachine commented 5 years ago

Using GeoFire 3.0 and Swift 4

The problem is when I query locations with given radius, it gives only one location and the location is own location. When I run the app from simulator and it gives only one location again and this location is simulator's location. I can't get any other users' locations.

I want to get all location entries in database according to given radius.

Here is my setLocation func:

     self.geoFire.setLocation(location, forKey: uid) { (error) in
          }

And this is my query:

self.geoFire.query(at: self.userLocation!, withRadius: 2.0).observe(.keyEntered) { (str, loc) in

            print("*****", str, loc.coordinate.longitude, loc.coordinate.latitude)

        }

Database Structure is here!

I'm truly sure that all these locations are in given radius.

Also, I'm giving this tip on console.

Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ".indexOn": "g" at /Users/6VRAyf3HFZfFXUH5TWBtB6v1om22 to your security rules for better performance

What does it mean?