[英]There is an optional error while downloading the image from the storage, I have converted the string to URL
從firebase存儲中下載映像時出現可選錯誤,我將字符串轉換為URL以下載映像
這里是發生錯誤的代碼,如果需要更多代碼,請告訴我
let imageUrl = URL(string: post._postuserprofileImagUrl)
ImageService.getImage(withURL: imageUrl) { image in
self.profileImageView.image = image
}
您必須(安全地)解包URL實例
if let imageUrl = URL(string: post._postuserprofileImagUrl) {
ImageService.getImage(withURL: imageUrl) { image in
self.profileImageView.image = image
}
}
或者甚至(如果postuserprofileImagUrl
也是可選的)
if let userprofileImagUrl = post._postuserprofileImagUrl,
let imageUrl = URL(string: userprofileImagUrl) {
ImageService.getImage(withURL: imageUrl) { image in
self.profileImageView.image = image
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.