几个小时以来,我一直在尝试解决这个问题,但似乎没有任何效果。
我想使用 FirebaseStorageUI 和 SDWebImage 在 uitableviewcell 上显示图像。我用了this教程作为引用(请参阅该网站上的“使用 FirebaseUI 下载图像”部分)。
这是我的代码在 tableview willDisplay 单元格上的样子:
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
let cell = cell as! CategoryCell
let title = categoriesData[indexPath.row].name
let refTest = FIRStorage().reference().child("images/categories/testImage.jpg")
cell.bgImageView.sd_setImage(with: refTest, placeholderImage: #imageLiteral(resourceName: "placeholderImg")) {(image, error, cacheType, storageRef) in
if let error = error {
print("error downloading image: \(error)")
}
}
cell.bgImageView.alpha = 0.5
cell.titleLabel.text = title
}
这是错误信息:
error downloading image: Error Domain=FIRStorageErrorDomain Code=-13040 "User cancelled the upload/download." UserInfo={NSLocalizedDescription=User cancelled the upload/download.}
我做错了什么?
最佳答案
在FIRStorage
之后添加.storage()
。
应该是这样的:
let refTest = FIRStorage.storage().reference().child("images/categories/testImage.jpg")
关于ios - 使用 FirebaseStorageUI + SDWebImage 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44251661/