-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Geofire iOS - Is there a way to retrieve the full data matching the geo query not just the keys and locations? #101
Comments
Responding late but it will be helpful for others too who are looking for the same.
Run your project and just fix the errors I mean pass this third parameter in this block. For example replace
They are getting snapshot from |
Hey, I am not familiar with objective C so it's hard for me to understand its code. If you have done this so can you please share your files? Actually there is no property like "snapshot" inside "info". At some points I have data snapshot object so I can pass that to block but at some instance there is nothing like that. |
So I have changed the file GFQuery.m here is the link and I have changed line number 45 in GFQuery.h here is the code I am just using to get end result
|
@ch-muhammad-adil Sorry i was not active here so could not respond to your query. I'm glad to hear that you have done this yourself. Cheers!! 👍 |
I find this very useful for my project but is it possible to have dataChanged like there are .keyEntered, keyExited and .keyMoved I need to have snapshot change |
Hi @nole87!! GeoFire is for location filter based on radius. I'm not sure about your query why do you need snapshot change event in GeoFire? You can add a different listener for that case. |
In realtime DB I also have some data in same place where it's location data, l/0,l/1 and g. In android geofire there are listener with onDataChanged, I need this also for iOS swift. Why? One app feature needs to receive all realtime changes with radius of 10km(it's now adjusted to 10km), so in iOS swift I can adjust firebase realtime db to receive 10km by x or y, but not by x and y, so I try geofire and it works for android, but for iOS swift there is no data change listener. This is traffic issue if app become popular otherwise it's not important but I must prepare for this scenario where app have millions of users, 1 million is enough for market that I want :) |
I add new observer and now trying to modify updateLocationInfo in GFQuery.m to make it work well, and I adjust data change observer but it's also fired when data entered, and when data changed,it will work well, best if I disable to fire when data entered, I have:
and there is !isNEw but it fire when data is entered ... |
@nole87 I have achieved this by doing following changes in I just defined one more block in
Then made its property as well.
Now in
These methods call according to their event types so you can use that block here.
Thats it, Now you will be notify each time there is any change, addition or deletion in this node.
I have also uploaded both classes GFQuery.h & GFquery.m. Just replace these with existing files. And below is Objective-C code how I'm using it:
|
it works, both solution your and mine :) THANKS! Now I must choose between two solutions :) |
#101 Implementation. Add observers with snapshots.
I have this....but the error message says "Contextual closure type '(String, CLLocation) -> Void' expects 2 arguments, but 3 were used in closure body"...but if I only take two arguments it says "Ambiguous use of 'observe'".....
|
Hi! I use this code:
and this pod: pod 'GeoFire', '~> 4.0.1' but after pod update or install I change a little bit pod classes in project, write me on ivankovic87@gmail.com so I can send you classes and just copy paste it and it will work ... |
I wonder whether it's possible to get the full data that matches the Geoquery. For example, if I point my Geofire reference to my user and every user has his or her own location. By specifying the radius and center I want, ideally, I want to retrieve some sort of snapshots that contains a list of users given that center and radius instead of just the user ids and the locations information.
From the doc here, it only has an example get all the keys(since we are passing user id as the key when we created those geo locations, they will be the key retrieved from the observeEventType method below) that match the query, like so
Otherwise, I have a make a query for each user to load their additional information, which is not good for actual practice.
Thanks
The text was updated successfully, but these errors were encountered: