退出Firebase块后,将删除查询数据

时间:2016-07-18 02:11:26

标签: ios firebase firebase-realtime-database geofire

我运行了一个firebase查询,以便在将结果传递给GeoFire之前检索用户存储的搜索半径。它看起来像这样:

select f1, f2 from ( 
select f1,f2,count(*) from test group by f1,f2 having count(*) in (
select max(total) as freq from (
select f1, f2, count(*) as total from test group by f1,f2) 
as test_temp group by f1)
) as final_results
----------------------------------------------------------------------
Total MapReduce CPU Time Spent: 9 seconds 700 msec
OK
1   A
2   C
Time taken: 75.901 seconds, Fetched: 2 row(s)

第一个打印行打印出我存储的半径(在这种情况下为4.xxxxxx),但是在括号外的第二个打印行之后打印。所以我在我的控制台中的结果看起来像是:

var searchRadius = Double()

ref.childByAppendingPath("/users/\(ref.authData.uid)/searchRadius").observeEventType(.Value, withBlock: { snapshot in

    self.searchRadius = snapshot.value as! Double
    print(self.searchRadius)
})
    print(self.searchRadius)

这是为什么?我遇到了类似firebase的问题并用ObserveReadyWithBlock解决了这个问题,但这是我第一次在Firebase中看到这个问题。

感谢您的帮助!

0 个答案:

没有答案