尝试保存用户photoURL时出现以下错误。任何想法为什么?
databaseRef.child("users(Auth.auth().currentUser?.uid)").observe(.value, with: { (snapshot) in
DispatchQueue.main.async {
let user = Userdata(snapshot: snapshot)
self.username.text = user.username
self.country.text = user.country
self.email.text = user.email
let imageUrl = String(user.photoUrl) // this is where I get the error
self.storageRef.reference(forURL: imageUrl!).getData(maxSize: 1 * 1024 * 1024, completion: { (data, error) in
if let error = error {
print(error.localizedDescription)
}else {
if let data = data {
self.userImageView.image = UIImage(data: data)
}
}
})
}