SDWebImageDownloader returns nil value

437 views Asked by At

SDWebImageDownloader returns nil instead of SDWebImageOperation object. Some code below.

class PictureProvider: UIActivityItemProvider {
    private var originalLoadingOperation: SDWebImageOperation?

    fileprivate func loadOriginalImage(with link: String) {

        let imageDownloader = SDWebImageDownloader.shared()
        originalLoadingOperation = imageDownloader!.downloadImage(with: URL(string: link),
                                                               options: .continueInBackground,
                                                              progress: nil,
                                                             completed: { (image, data, error, finished) in 

                                                                 if image != nil
                                                                 {
                                                                     SDImageCache.shared().store(image, forKey: link)
                                                                 }
        })
    }
}

originalLoadingOperation is always 'nil'.

0

There are 0 answers