Changing query parameters for observeEventType in iOS

24 views
Skip to first unread message

arpit goel

unread,
Mar 24, 2015, 2:09:50 AM3/24/15
to fireba...@googlegroups.com
Hi

I am trying to do the following sync with my firebase server for (only) updates. So I want to send the timestamp of the last update and only request the new updates from the server using observeEventType.

So I do the following:

            [[[self.myRootRef queryOrderedByChild:@"timestamp"] queryStartingAtValue:timestamp] observeEventType:FEventTypeValue withBlock:^(FDataSnapshot *snapshot) {

                       timestamp = snapshot.timestamp;

            }];


This clearly doesn't work. The timestamp is updated but the new timestamp is not used as a query parameter. I was wondering if there's a way to change the query inside the block, or if there's some other way to achieve this? Any help would be greatly appreciated. Thanks!

Frank van Puffelen

unread,
Mar 24, 2015, 12:44:15 PM3/24/15
to fireba...@googlegroups.com
As far as I know queries are immutable, you can only specify their parameters when you initially create them. So you'll have to stop the listeners on the current query and create a new query when the timestamp changes.
Reply all
Reply to author
Forward
0 new messages