我似乎无法解决此问题,感谢您的提前帮助! :D (类型'StorageMetadata'的值没有成员'downloadURLs')'
func sendMedia(picture: UIImage?) {
guard let photo = picture else { return }
print(picture)
print(Storage.storage().reference())
let filePath = "\(Auth.auth().currentUser!)/\(NSDate.timeIntervalSinceReferenceDate)"
print(filePath)
let data = photo.jpegData(compressionQuality: 0.1)
let metadata = StorageMetadata()
metadata.contentType = "image/jpg"
Storage.storage().reference().child(filePath).putData(data!, metadata: metadata) { (metadata, error) in
if error != nil {
print(error?.localizedDescription)
return
}
let fileURL = metadata!.downloadURLs![0].absoluteString
let newMessage = self.messageRef.childByAutoId()
let messageData = ["fileUrl": fileURL, "senderId": self.senderId, "senderName": self.senderDisplayName, "MediaType": "PHOTO"]
newMessage.setValue(messageData)
}
}
}