Firebase Storage not uploading/downloading correctly

I am trying to publish and download images from firebase storage.

I publish an Image, and then try to fetch it, which works, but when I try to replace that same image by another one, and then fetch that new image, it still shows me the old image, even though when I look in the database, it shows the new Image and nothing else.

There are no errors. This is how I am fetching my image.

let storageRef = Storage.storage().reference()
let ref = storageRef.child("Profiles/\(UserModel.docId).jpeg")
        
let placeHolderImage = UIImage(systemName: "person.circle.fill")   
profileImage.sd_setImage(with: ref, placeholderImage: placeHolderImage)

This is how I am uploading my images

let storageRef = Storage.storage().reference()
let ref = storageRef.child("Profiles/\(UserModel.docId).jpeg")

     
let metaData = StorageMetadata()
metaData.contentType = "image/jpeg"
ref.putData(ImageData, metadata: metaData)
Answered by Marco_Boi123 in 746686022

The solution was to delete the cache before retrieving the image. Like this : SDImageCache.shared.clearDisk()

Accepted Answer

The solution was to delete the cache before retrieving the image. Like this : SDImageCache.shared.clearDisk()

Firebase Storage not uploading/downloading correctly
 
 
Q