gpt4 book ai didi

ios - 类型 'StorageReference' 的值没有成员 'data'

转载 作者:搜寻专家 更新时间:2023-11-01 05:52:27 25 4
gpt4 key购买 nike

这段代码在几个月前就可以工作了,我检查了 GitHub 上的一些其他代码并验证了这段代码在过去也可以工作,但我找不到解决方案。我一直在寻找使用 Firebase 的解决方案 Migration Support ,但我没有运气。提前致谢!

    func configCell(searchDetail: Search) {

self.searchDetail = searchDetail

nameLbl.text = searchDetail.username

let ref = Storage.storage().reference(forURL: searchDetail.userImg)

//Error Below, highlighting 'ref.data' Error: Value of type 'StorageReference' has no member 'data'.

ref.data(withMaxSize: 1000000, completion: { (data, error) in

if error != nil {

print(" we couldnt upload the img")

} else {

if let imgData = data {

if let img = UIImage(data: imgData) {

self.userImage.image = img
}
}
}

})
}

最佳答案

根据您添加的迁移指南,您现在需要使用新的 getData(maxSize:completion:) 而不是 data(withMaxSize:completion:)。所以就这样吧。

ref.getData(maxSize: 1000000, completion: { (data, error) in

if error != nil {

print(" we couldnt upload the img")

} else {

if let imgData = data,let img = UIImage(data: imgData) {
self.userImage.image = img
}
}

})

关于ios - 类型 'StorageReference' 的值没有成员 'data',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44839594/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com