I set an observer for some directory, represented as ref in this case like so (simplified code sample):
ref.observe(.value, with: { snap in if snap.exists(){ let some = MyStructure(snap: snap) print(some.date) } }) The problem is, even though the data in that location (ref) does never change, handler gets called multiple times (usually 2 times) and, what's bugging me most, with different data for just one field (the date one). Any thought on why this could be happening?
P.S. I usually remove all observers for a reference inside its callback handler, but, in this case, I can't do that, since the first call returns data with wrong date field, yet the next one tends to be the right one.
P.S.S. I cannot use '.observeSingleEvent' method, since it uses cached data (stored by Firebase, I believe), and here it is essential to retrieve only relevant data.
0value for a timestamp. Without seeing how you got into this situation, it's hard to say anytjing more than that.