I am misusing the index in the following code for this Firebase data stream, but I cannot figure out what I'm doing wrong. I get the error message: Ambiguous use of index for string let uniqueID = each.value["Unique ID Event Number"] as! Int let uniqueID = each.value["Unique ID Event Number"] as! Int .
// Log user in if let user = FIRAuth.auth()?.currentUser { let uid = user.uid // values for vars sevenDaysAgo and oneDayAgo set here ... let historyRef = self.ref.child("historyForFeedbackLoop/\(uid)") historyRef.queryOrdered(byChild: "Unix Date").queryStarting(atValue: sevenDaysAgo).queryEnding(atValue: oneDayAgo).observeSingleEvent(of: .value, with: { snapshot in if (snapshot.value is NSNull) { print("user data not found") } else { if let snapDict = snapshot.value as? [String:AnyObject] { for each in snapDict { // Save the IDs to array. let uniqueID = each.value["Unique ID Event Number"] as! Int self.arrayOfUserSearchHistoryIDs.append(uniqueID) } } else{ print("SnapDict is null") } } }) }
I tried to apply what I learned from this post, but I could not understand what I was missing, because I thought I was letting the compiler know what type of dictionary it is with "how? [String: AnyObject]"
Any thoughts or ideas would be greatly appreciated!
source share