只需更新新的firebase,现在我在第10行收到上述错误...
它在firebase 3和4下运行,但是由于他们删除了downloadURL而不再在第五版中运行...请不要重复这个问题或类似问题,因为我已经在互联网上尝试了任何解决方案,但没有任何效果...
fileprivate func handleVideoSelectedForUrl(_ url: URL) {
let filename = UUID().uuidString + ".mov"
let uploadTask = Storage.storage().reference().child("message_movies").child(filename).putFile(from: url, metadata: nil, completion: { (metadata, error) in
if error != nil {
print("Failed upload of video:", error!)
return
}
if let videoUrl = metadata?.downloadURL()?.absoluteString {
if let thumbnailImage = self.thumbnailImageForFileUrl(url) {
self.uploadToFirebaseStorageUsingImage(thumbnailImage, completion: { (imageUrl) in
let properties: [String: AnyObject] = ["imageUrl": imageUrl as AnyObject, "imageWidth": thumbnailImage.size.width as AnyObject, "imageHeight": thumbnailImage.size.height as AnyObject, "videoUrl": videoUrl as AnyObject]
self.sendMessageWithProperties(properties)
})
}
}
})
最佳答案
//在putData响应中更近您可以使用以下更新的代码获取downloadURL
metadata?.storageReference?.downloadURL(completion: { (url, error) in
print(url)
})
在此之前,您可以像
metadata?.downloadURL()
关于swift - 绝对字符串->“类型'StorageMetadata'的值没有成员'downloadURL'”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51582844/