Я пытаюсь реализовать чат для firebase, но получаю эту ошибку: Значение типа 'StorageMetadata' не имеет члена 'downloadURLs' из этого кода:
var fileUrl: String!
func CreateNewRoom(user: User, caption: String, data: NSData) {
let filePath = "\(user.uid)/\(Int(NSDate.timeIntervalSinceReferenceDate))"
let metaData = StorageMetadata()
metaData.contentType = "image/jpg"
storageRef.child(filePath).putData(data as Data, metadata: metaData) { (metadata, error) in
if let error = error {
print("Error uploading: \(error as NSError)")
return
}
self.fileUrl = metadata!.downloadURLs![0].absoluteString
if let user = Auth.auth().currentUser {
let idRoom = self.BASE_REF.child("rooms").childByAutoId()
idRoom.setValue(["caption": caption, "thumbnailUrlFromStorage": self.storageRef.child(metadata!.path!).description, "fileUrl": self.fileUrl])
}
}
}