geofire-objc icon indicating copy to clipboard operation
geofire-objc copied to clipboard

Query didn't return result

Open Alkalouti opened this issue 7 years ago • 0 comments

I have a list of stores as below:

"store" : {
    "2" : {
      "address" : "amman",
      "ctime" : "17:05:00",
      "g" : "9q8yyxfgs8",
      "id" : "11",
      "l" : [ 31.9453666, 35.9283716 ],
      "name" : "Kaluti",
      "otime" : "00:00:00",
      "phone" : "0795080034",
      "userId" : "4"
    },
    "7" : {
      "address" : "amman",
      "ctime" : "01:00:00",
      "g" : "9q8yyxfgs8",
      "id" : "7",
      "l" : [ 31.9453666, 35.9283716 ],
      "name" : "Zalloum33",
      "otime" : "05:00:00",
      "phone" : "0795080034",
      "userId" : "2"
    },
    "11" : {
      "address" : "amman",
      "ctime" : "17:05:00",
      "g" : "9q8yyxfgs8",
      "id" : "11",
      "l" : [ 31.9453666, 35.9283716 ],
      "name" : "Kaluti",
      "otime" : "00:00:00",
      "phone" : "0795080034",
      "userId" : "4"
    },
    "12" : {
      "address" : "asd",
      "ctime" : "22:00:00",
      "g" : "9q8yyxfgs8",
      "id" : "12",
      "l" : [ 37.7922, -122.4056973 ],
      "name" : "Amam",
      "otime" : "10:00:00",
      "phone" : "0795126776",
      "userId" : "4"
    },
    "19" : {
      ".priority" : "9q8yyxfgs8",
      "g" : "9q8yyxfgs8",
      "id" : "10",
      "l" : [ 37.7922, -122.4056973 ],
      "name" : "ahmad"
    }
  }

when I try to fetch this location with this code the query didn't return any value

let center = CLLocation(latitude: 31.97375, longitude: 35.872316)


        if let circleQuery = geoFire?.query(at: center, withRadius: 1.0) {
            _ = circleQuery.observe(.keyEntered) { (key, location) in
                print("Key '\(key)' entered the search area and is at location '\(location)'")
            }
            
            circleQuery.observeReady{
                print("All initial data has been loaded and events have been fired for circle query!")
            }
        }

but if I try to use the same code and just change the CLLocation with let center = CLLocation(latitude: 37.7832889, longitude: -122.4056973) it's return data.

please advice me where's the problem??

Alkalouti avatar Mar 15 '17 22:03 Alkalouti