SDWebImageDownloader返回nil值

时间:2017-01-18 08:38:57

标签: ios swift3 sdwebimage uiactivityitemprovider

SDWebImageDownloader返回nil而不是SDWebImageOperation对象。下面是一些代码。

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总是' nil'。

0 个答案:

没有答案