【发布时间】:2018-05-10 07:26:19
【问题描述】:
所以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))
但是,完成块永远不会被调用。
【问题讨论】:
-
print("progressing here in this block") : 这是打印出来的?
-
是的,它到达了进度块,但没有到达完成块
-
有什么解决办法吗?
标签: ios swift image caching sdwebimage