I'm having this problem, im trying to retrieve data from the firebase database, but it's saying the profilepic isn't a key, but it is. This is the object class.
class User: NSObject {
    var firstname: String?
    var lastname: String?
    var username: String?
    var profilepic: String?
}
and this is me trying to retrieve
func getusers(){
        ref.child("Friends").child(currentuser!).observe(.childAdded, with: { (snapshot) in
            print(snapshot)
            if let dic = snapshot.value as? [String: AnyObject]{
                let user = User()
                user.setValuesForKeys(dic)
                print(user.firstname, user.lastname)
                DispatchQueue.main.async {
                    self.tableview.reloadData()
                }}
        }) { (error) in
            print(error.localizedDescription)
        }
    }
and the crash is here user.setValuesForKeys(dic).
Anyone has any idea why isn't working?
 
     
    