2017-10-04 8 views
0

タイトルのとおりです。このエラーがスローされていて、これがSwift 4変換と関係があるかどうかはわかりません。私はコードを回避しようとしていますが、まだ運がないので、この問題をSOに投げつけることに決めました。このエラーは、ライン上に投げている: "cell.businessPostImage.setImageWith(postRequest、" おかげでSwift 4エラー:「 'URLRequest'型の値を 'URL!'型に変換できません」

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) 
      }) 
     } 

This is the error its getting thrown WITH the edit

+0

postURL 'でパス'postRequest'の代わりに' – rmaddy

+0

'を使用してください。画像を確認してください。編集のためにスローされた新しいエラーが追加されました。 –

+0

クローズを 'options'パラメータに渡そうとしています。 – rmaddy

答えて

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) 
    }) 
} 
関連する問題