I have setup images on my app to work with firebase UI so that I can cache them easily, by following the docs https://firebase.google.com/docs/storage/ios/download-files
My code looks something like this
guard let profileImageUrl = user?.url else { return }
profileImageView.sd_setImage(with: profileImageUrl)
I am overwriting the image location to update the image like this
let storageRef = Storage.storage().reference(withPath: "/users/\(uid)/profilePhoto.jpg")
storageRef.putData(uploadData, metadata: nil, completion: { (metadata, err) in
If I go to the photo on a new device with no cache yet, it shows the new image. However, if i go to the image on a device that previously viewed it I am left seeing the old image.
EDIT: So I understand the cache works through SDWebImage. I am generating a storage reference to use with SDWebImage based on the users uid. The storage reference is therefore not changing, which is causing the issue.
from Firebase Storage Image Cache not updating SWIFT
No comments:
Post a Comment