Reputation: 301
For some reason i cannot receive the values of my child and im not understanding why. Each value is represented as a double.
Does not make it past
if let snapDict = snap.value as? [Double:AnyObject]{
func recieveChartValues() {
//Firebase Initialization
var ref: FIRDatabaseReference!
ref = FIRDatabase.database().reference()
ref.child("general_room_index").observeSingleEvent(of: .value, with: {(snap) in
if let snapDict = snap.value as? [Double:AnyObject]{
for each in snapDict{
print("key ", each.key)
self.values.append(each.key)
}
}
})
}//retrive values func
Upvotes: 0
Views: 233
Reputation: 22374
If all of the keys are integers, and more than half of the keys between 0 and the maximum key in the object have non-empty values, then Firebase will render it as an array.
So I believe that you always use some string as key rather than Int because sequential manner key often converted in to arrays as firebase believes that its auto incremented ...
More info. check this answer
Upvotes: 1