SDWebImage下载图像完成块未被调用

时间:2017-11-27 05:30:10

标签: ios swift image caching sdwebimage

所以SDWebImage Download image and store to cache for key这正是我想在我的应用程序中做的事情。我想将图像存储在一个键中,然后再获取图像。这是我的代码块:

SDWebImageManager.shared().imageDownloader?.downloadImage(with: URL.init(string: url), options: SDWebImageDownloaderOptions.highPriority, progress: { (receivedSize:Int,expectedSize:Int,url : URL?) in
  print("progressing here in this block ")
}, completed: ({(image : UIImage, data : Data,error : Error, finished : Bool)  in
  print("reached in the completion block ")

  if finished {
    SDImageCache.shared().store(image, forKey: "d", toDisk: true, completion: nil)
  } else {
    print(error.localizedDescription)
    showAlert(viewController: self, title: "", message: error.localizedDescription)
  }           
} as? SDWebImageDownloaderCompletedBlock))

但是,永远不会调用完成块。

0 个答案:

没有答案
相关问题