参见英文答案 >
Upgrading Firebase broke my iOS project 1个
我更新到firebase存储4.0,现在我得到这个错误,说storageRef没有成员“put”.它曾在旧版本的Firebase中运行.
我更新到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