2021年1月5日星期二

Anyone know how to resolve "Ambiguous use of 'subscript(_:)'" error with Firebase?

I am trying to develop followers for an app. Here is the code I have to retrieve the current authenticated users (minus the logged in user) and create a local list. I also have code to write a followers list to the Firebase but just this code (step 1) is throwing errors.

func retrieveUsers() {          let ref = Database.database().reference()          ref.child("users").queryOrderedByKey().observeSingleEvent(of: .value, with: {snapshot in              let users = snapshot.value as! [String: AnyObject]              self.user.removeAll()              for (_, value) in users {                  if let uid = value["uid"] as! String {                      if uid != Auth.auth().currentuser.uid {                          let userToShow = User()                          if let firest_name = value["firest_name"] as? String {                              userToShow.userId = uid                              self.user.append(userToShow)                              }                      }                  }              }              self.tableView.reloadData()              })      }  
if let uid = value["uid"] as! String {   

is throwing Ambiguous use of 'subscript(_:)' which I really do not understand. Any help is appreciated!

https://stackoverflow.com/questions/65587587/anyone-know-how-to-resolve-ambiguous-use-of-subscript-error-with-firebas January 06, 2021 at 06:39AM

没有评论:

发表评论