正如标题所说的那样。我收到此错误并且不确定这是否与Swift 4转换有关。我一直在尝试解决代码,但没有运气,所以决定把这个问题提出来。这个错误正在上线:" cell.businessPostImage.setImageWith(postRequest,"。谢谢。
cell.businessPostImage.image = nil
if let postURL = URL(string: downloadURL) {
let postRequest = URLRequest(url: postURL)
cell.businessPostImage.setImageWith(postRequest, placeholderImage: nil, options:
{ (imageRequest, imageResponse, image) in
cell.businessPostImage.contentMode = UIViewContentMode.scaleToFill
cell.businessPostImage.image = image
}, completed: { (imageRequest, imageResponse, error) -> Void in
// failure downloading image
print("Error downloading Firebase post image")
print(error)
})
}
答案 0 :(得分:1)
你必须这样使用:
if let postURL = URL(string: downloadURL) {
let postRequest = URLRequest(url: postURL)
cell.businessPostImage.setImageWith(postURL, placeholderImage: nil, options: SDWebImageOptions.ProgressiveDownload, completed: { (imageRequest, imageResponse, error) -> Void in
// failure downloading image
print("Error downloading Firebase post image")
print(error)
})
}