It's hard to explain this in a comment, so I will review your current problem here, but Paulo answered your question, I suppose. You can even open a new question on this issue.
Here is the code you are having trouble with:
for (key, rating) in ratings.value as! [String: Int] { self.updatePlace(key, rating: rating) }
There is nothing wrong with this code if the ratings.value value is filled in whole whole pairs. Your error occurs due to a missing key. (The runtime detected NSNull, so it could not convert the data to a dictionary)
You need to set a breakpoint at which you are building the array:
placeSnapshot.childSnapshot(forPath: "rating")
(which is called rating here / locally). If itβs normal to ignore keyless entries, skip them and do not add to your array. But most likely you have an error and you need to find out why you are adding a null value ...
It makes sense? Please accept Paulo's answer if he solves the problem, and open a new question with additional information about childSnapshot (code), and someone will definitely help you. (I know I will try.)
Mozahler
source share