Tag: firebase geofire

GeoFire更新在同一个电话

我正在创build一个像这样的Firebase更新词典 NSDictionary *update = @{ key1 : value1, key2 : value 2, key3 : value 3 }; [baseRef updateChildValues:update withCompletionBlock:^(NSError *error, Firebase *ref) { // complete }]; 但我也想保存一个位置的坐标在同一个更新,也就是不必做2个单独的调用。 我已经看了这个 Github页面,但我不知道如何做这样的事情 [geoFire setLocation:[[CLLocation alloc] initWithLatitude:37.7853889 longitude:-122.4056973] forKey:@"firebase-hq"]; 在我的第一个例子相同的更新? 有没有这样做的首选方法,还是我需要自己做一些东西? 例如更改库或将CLLocation设置为任何其他variables的更新? 像这样的东西: -(void)setLocation:(CLLocation *)location forRef:(Firebase *)ref { NSNumber *lat = [NSNumber numberWithDouble:location.coordinate.latitude]; NSNumber *lng = [NSNumber numberWithDouble:location.coordinate.longitude]; […]

查询与GeoFire链接的Firebase数据

在阅读这些问题之后: 将Geofire位置与Firebase条目相关联 使用Geofire + Firebase过滤结果 我明白,对于给定的实例,该对象的位置数据和常规数据必须保持分开,因此我必须有不同的监听器。 首先find位置数据,然后find与位置查询find的对象相对应的每个对象。 但是,我的问题是关于听众的实际数据本身,而不是位置数据。 为了举例说明,假设我有一个应用程序,可以在用户当前位置附近find“餐馆”对象列表。 我明白,这必须使用GeoFire来完成,但是每个返回的快照都需要单个事件侦听器来检索额外的数据吗? 详细说明一下,如果我想知道餐厅的其他方面何时发生变化(评级,小时,座位可用)呢? 单个事件值监听器不会这样做,因为它不会监听这些餐馆的不断变化。 最好的办法是什么呢?

如何在Swift中观察下面的GeoFire句柄?

这是Swift,Firebase和Geofire的问题。 我想知道如何在Swift中为下面的观察者删除一个GeoFire句柄。 locationsEnd!.query(at: location, withRadius: 16.0).observe(GFEventType.init(rawValue: 0)!, with: {(key, location) in 以下工作正常(在viewDidDisappear): locationsEnd?.firebaseRef.removeAllObservers() 然而,处理它不: var locationHandle: UInt = 0 override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) //following does not work: locationsEnd?.firebaseRef.removeObserver(withHandle: locationHandle) } func aroundMe(_ location: CLLocation){ locationHandle = locationsEnd!.query(at: location, withRadius: 16.0).observe(GFEventType.init(rawValue: 0)!, with: {(key, location) in //etc }) } 我已经尝试了locationHandle如下,没有成功: var locationHandle = […]

用户位置上的GeoFire查询

与Firebase及其位置库GeoFire一起工作是相当新的。 目前我在构build数据时遇到了一些问题。 目前我的数据库是这样的: users facebook:xxxxx displayName: xx firstName: xx lastName: xx location: g: xxxx l: 0: xxx 1: xxx facebook:yyyyy displayName: yy firstName: yy lastName: yy location: g: yyyy l: 0: yyy 1: yyy 我想查询我的当前用户login附近的用户。要做到这一点,我不明白我必须指定什么path。 此刻我正在做这样的事情(但那不行): 节省当前位置 let root = Firebase(url: "myapp.firebaseio.com") let usersRoot = root.childByAppendingPath("users") geoFire = GeoFire(firebaseRef: usersRoot.childByAppendingPath(root.authData.uid)) geoFire.setLocation(currentLocation, forKey: "location") { (error) […]