0

When the same data is accessed on different devices, the data is not consistent between the two.

For example, if one user updates a node of data from one device, it is not reflected on another device querying the same data via observeSingleEvent.

Should I be using a different query than this?

vikzilla
  • 3,998
  • 6
  • 36
  • 57
  • 1
    My guess is that you're looking for this: http://stackoverflow.com/questions/34486417/firebase-offline-capabilities-and-addlistenerforsinglevalueevent/34487195#34487195 (the question is about Android, but the behavior is exactly the same on iOS). But without seeing the minimal code that reproduces the problem, it is hard to say more. – Frank van Puffelen Oct 04 '16 at 16:49

1 Answers1

1

Well, it depends on your exact setup, but my guess is that using observeSingleEventOfType is the problem. That means the your app observes an event once, and then basically ignores any future events, including future updates. So if your app works something like this...

  1. First app starts up
  2. First app uses observeSingleEventOfType to populate its initial data
  3. Second app updates a node of data

...that first app won't update its data. The single event has already been "used up" with that initial call.

If your expecting your app to keep updating your data, I'd probably recommend trying out observeEventOfType methods and see if that addresses your issue.

Todd Kerpelman
  • 16,875
  • 4
  • 42
  • 40
  • I am using observeEventOfType with the FIRDataEventType .value for my query and everything looks to be updating and observing changes to the JSON. Thanks – vikzilla Oct 05 '16 at 15:42