参见英文答案 Upgrading Firebase broke my iOS project1个 我更新到firebase存储4.0,现在我得到这个错误,说storageRef没有成员“put”.它曾在旧版本的Firebase中运行. if let selectedImage = selectedImageFromPick
我更新到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]) } }) } }根据Firebase的 migration support,它已被更改为putData(_:metadata:completion