I'm using firebase with app started in offline mode, when i'm subscribing to child values of some node the callback from observe*(_:,withBlock:)
is not firing (neither for initial values nor changes). Subscriptions to direct values (childless) works fine. Take a look at a snippet :
let database = FIRDatabase.database()
database.reference().keepSynced(true)
let databaseRef = database.reference()
database.goOffline()
databaseRef.child("user").setValue("user1")
let userKey = databaseRef.child("usr").childByAutoId().key
let userValues = ["uid": "uid",
"name" : "name",
"surname" : "surname"]
databaseRef.child("/usr/\(userKey)/").setValue(userValues)
//1
databaseRef.child("user").observeSingleEventOfType(.Value, withBlock:{ snap in
print("works")
})
//2
databaseRef.child("usr").observeSingleEventOfType(.Value, withBlock:{ snap in
print("doesnt work")
})
//3
databaseRef.child("usr/\(userKey)/uid").observeSingleEventOfType(.Value, withBlock:{ snap in
print("works")
})`
subscriptions 1 & 2 works fine, but subscribtion 2 won't fire, until at least once database go online. From the moment database syncronize with remote i can go offline and everything works as it should. Anyone know how to handle this issue?