iosswiftsdwebimage

SDWebImage checking if image cached using Swift: Ambiguous Reference


I am trying to find out if an image has already been cached using SDWebImage but when I try to use this method I get the error "Ambiguous reference to member 'cachedIageExistsForURL".

let bool = SDWebImageManager.cachedImageExistsForURL(imgURL)

I am using Swift and I have a bridging header to use the library.


Solution

  • cachedImageExistsForURL is not a class method on SDWebImageManager, it's an instance method which you need to use on the sharedInstance:

    SDWebImageManager.sharedManager().cachedImageExistsForURL(imgURL)