Reputation: 1754
I have this code for getting data from firebase database :
FIRDatabase.database().reference().child("Root").child("User1").child("chat1")
.observeSingleEvent(of: .value , with: { snapshot in
if snapshot.exists() {
let recent = snapshot.value as! NSDictionary
print(recent)
})
There is a problem with the result of snapshot, the print(recent)
sometimes prints all values of that child (10 values) which is the thing I want, but some time it prints only two values of that child I don't know why.
How to fix this ?
This is my database structure :
Upvotes: 0
Views: 1684
Reputation: 13013
Since I can not comment and I just want to ask something, I will remove this answer later on, but is your data in sync? Did you call the method yourreference.keepSynced(true)?
Upvotes: 2