How to clear all cached images loaded from SDWebImage? How to clear all cached images loaded from SDWebImage? ios ios

How to clear all cached images loaded from SDWebImage?


If you want to completely clear the cache do the following:

Obj-c:

- (IBAction)clearCache:(id)sender {    [[SDImageCache sharedImageCache]clearMemory];    [[SDImageCache sharedImageCache]clearDisk];}

Swift 5

SDImageCache.shared.clearMemory()SDImageCache.shared.clearDisk()

Swift 3.0

@IBAction func clearCache(sender: UIButton) {    SDImageCache.shared().clearMemory()    SDImageCache.shared().clearDisk()}


Try this:

@IBAction func actClearCache(sender:AnyObject) {   let objCache = SDImageCache.sharedImageCache()   objCache.clearMemory()   objCache.cleanDisk()}


Swift 4.2 , Xcode 10

pod 'SDWebImage', '5.0.0-beta3'

import SDWebImage @IBAction func ClearCacheButtonClick(_ sender: UIButton) {     SDImageCache.shared.clearMemory()     SDImageCache.shared.clearDisk() }


matomo