3

I'm running into issues with GeoFire.

First, per the documentation on the Geofire github page I cannot install the cocoapod. After searching, I found that the correct way to set the podfile is:

    pod 'GeoFire', :git => 'https://github.com/firebase/geofire-objc.git'

Not sure if that has anything with the code not working as expected, but the following does not work:

    if  let geoFire = GeoFire(firebaseRef: self.firebaseRef) {

 //this is an exact match to an item in the database, there are others nearby as well
        let center = CLLocation(latitude: 40.72946918822954, longitude: -73.9883231047775)

        guard let circleQuery = geoFire.query(at: center, withRadius: 5) else {
            return
        }

        var results = [String]()

        circleQuery.observe(.keyEntered, with: { (key, location) in
            if let result = key {
               results.append(result)
            }
        })

        circleQuery.observeReady({ 
            print("ALL ARE LOADED: \(results)")
            circleQuery.removeAllObservers()
        })

The following code has no results. Any idea why?

adjuremods
  • 2,938
  • 2
  • 12
  • 17
Buyin Brian
  • 2,781
  • 2
  • 28
  • 48

0 Answers0