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]; NSDictionary *update = @{ @"location" : @[ lat, lng ] }; [ref setValue:update withCompletionBlock:^(NSError *error, Firebase *ref) { // complete }]; } 

编辑

这里有一个和我的项目非常相似的代码:

 -(void)uploadUserId:(NSString *)userId withPlace:(GMSPlace *)place { Firebase *ref = [[Firebase alloc] initWithUrl:baseRefUrl]; NSNumber *lat = [NSNumber numberWithDouble:place.coordinate.latitude]; NSNumber *lng = [NSNumber numberWithDouble:place.coordinate.longitude]; NSString *geoHash = [GFGeoHash newWithLocation:place.coordinate].geoHashValue; NSDictionary *locationDetails = @{ @"l" : @[ lat, lng ], @"g" : geoHash}; NSDictionary *update = @{ [NSString stringWithFormat:@"/users/%@/", userId] : locationDetails }; [ref updateChildValues:update withCompletionBlock:^(NSError *error, Firebase *ref) { // complete }]; } 

如果你更新你的字典到:

  NSDictionary *locationDetails = @{ @"l" : @[ lat, lng ], @"g" : geoHash, @".priority": geoHash }; 

您还将设置节点的优先级,这是GeoFire所需的(afaik)。