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'。