首页 > 解决方案 > 使用 KingFisher 时不显示图像

问题描述

我不确定为什么会发生这种情况,但我之前使用过相同的代码,我从 firebase 存储下载的图像没有显示为按钮背景。我已经打印出 url,它正在获取 url,所以我不确定为什么图像没有显示。setUpView 函数在 viewdidload 中被调用,我也试过 viewwillappear

 private func setUpView(){
        self.setNavigationBarLogo()
        if User.currentUser() != nil {
            let currentUser = User.currentUser()!
            print(currentUser.profileImage)
            if let url = URL(string: currentUser.profileImage) {
                print("-----\(url)----")
                    self.profileImageBtn.kf.setBackgroundImage(with: url, for: .normal)
                    self.profileImageBtn.setTitle("", for: .normal)
                
            }
        }
        
    }

标签: swiftfirebasekingfisher

解决方案


推荐阅读