我更新到firebase存储4.0,现在我收到此错误,说storageRef没有成员“put”。它曾在旧版本的Firebase中运行。
if let selectedImage = selectedImageFromPicker {
profilePic.image = selectedImage
if let uploadData = UIImagePNGRepresentation(selectedImage) {
let storageRef = Storage.storage().reference().child("profile pictures").child("\(Auth.auth().currentUser?.uid).png")
storageRef.put/*error here*/(uploadData, metadata: nil, completion: {
(metadata, error) in
if error != nil {
print(error!)
return
}
print(metadata!)
if let profilePictureURL = metadata?.downloadURL()?.absoluteString {
let ref = FIRDatabase.database().reference()
let usersreference = ref.child("users").child(Auth.auth().currentUser?.uid).child("data")
usersreference.updateChildValues(["profile picture": profilePictureURL])
}
})
}
}