【发布时间】:2016-09-29 20:02:51
【问题描述】:
我将代码从 Swift 2 更新到 Swift 3,发现 SDWebImage 的错误。
SDWebImageManager.shared().downloadImage(with: URL(string: book.picURL), options: .lowPriority, progress: { (min:Int, max:Int) -> Void in
}) { (image:UIImage!, error:NSError!, cacheType:SDImageCacheType, finished:Bool, url:NSURL!) -> Void in
if image != nil && finished
{
let obj = cell.keepUrl
if obj != nil && url != nil && obj == url
{
cell.picURL.image = image
}
}
}
SDWebImageCompletionWithFinishedBlock的定义如下
typedef void(^SDWebImageCompletionWithFinishedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL);
错误信息是
“无法将类型 '(UIImage!, NSError!, SDImageCacheType, Bool, NSURL!) -> Void' 的值转换为预期的参数类型 'SDWebImageCompletionWithFinishedBlock!'”
谁能帮我解决这个错误?谢谢。
【问题讨论】:
标签: ios swift sdwebimage