我正在从Firebase获取数据并将其存储到Firebase中。 追加后,当我调用该数组时,其显示为空
var GetUseruiD = [String]()
this is my firebase appending data to array
self.userDataRef = GlobalUserData.shared.getUserDataReference()
.child(Constants.FLAT_Visitor).child(userUID)
self.userDataRef?.observeSingleEvent(of: .value, with: {(snapshot) in
if snapshot.childrenCount > 0 {
for users in snapshot.children.allObjects as! [DataSnapshot] {
GetUseruiD.append(users.key)
print("GetUseruiD is ",GetUseruiD)
}
}
})
print("GetUseruiD is ",GetUseruiD)
if am print the values is am getting err but inside Getuse
GetUseruiD is outside []
GetUseruiD is inside ["-LIK5CNBk0vKS_Tto64E"]
GetUseruiD is inside ["-LIK5CNBk0vKS_Tto64E", "-LIK5UbOBCQalyoqmQ-E"]