iosobjective-cimageviewasyncimageview

How to replace the cached AsyncImage with new image in ios


I have an AsyncImageView which is loading images of a profile.Once the user changed his/her profile picture it will replace the image in the same image URL.
Now Problem is it's loading the old image from cache instead of replace it with new one.
Can Any one help on this.Here is my code

[profImageView setImageURL:[NSURL URLWithString:imageURL]];

Solution

  • try this:

    NSCache *cache = [AsyncImageLoader defaultCache];
    
    [cache removeObjectForKey:[NSURL URLWithString:imageURL]];
    
    [profImageView setImageURL:[NSURL URLWithString:imageURL]];