0
我有商店的列表如下:GeoFire查詢沒有返回結果
"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"
}
}
,當我嘗試使用此代碼來獲取這個位置查詢沒有返回任何值
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!")
}
}
但如果我嘗試使用相同的代碼,只是改變CLLocation與
let center = CLLocation(latitude: 37.7832889, longitude: -122.4056973)
它的返回數據。
請指教我問題在哪裏?
謝謝你的建議,我試了一下,你送,但我仍然有同樣的問題 – Alkalouti
@Alkalouti如果用「讓中心= CLLocation(緯度:31.9453666,經度:35.9283716)「你會得到三個結果嗎? –
不,我沒有得到任何結果,但如果我添加讓中心= CLLocation(緯度:37.7832889,經度:-122.4056973)它返回兩個結果 – Alkalouti