iosswiftsdwebimage

How to resolve this error : "Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)"?


I am using this SDWebImage framework. And the error shows:

"Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)".

Error

let thumbImgaURL = URL(string: movie.movieThumbMailURL!)
self.imgMovie.sd_setImage(with: thumbImgaURL, placeholderImage:#imageLiteral(resourceName: "Ic_video_Placeholder"), options: .cacheMemoryOnly) { (thumbImage, error,chache, imgURL) in
  if thumbImage != nil {
       self.imgMovie.image = thumbImage!
  }
  else {
       print("OK2")
  }
}

Solution

  • Your placeholder image placeholderImage not found just set placeholderImage to nil or add image

    let thumbImgaURL = URL(string: "https://i.sstatic.net/sFW9w.png")
        self.imgMovie.sd_setImage(with: thumbImgaURL, placeholderImage:nil, options: .cacheMemoryOnly) { (thumbImage, error,chache, imgURL) in
            if thumbImage != nil {
                self.imgMovie.image = thumbImage!
            }
            else {
                print("OK2")
            }
        }