I cannot find the solution for the issue. I have the following code
let imgData = self.getImgData(id: (entry["id"] as? Int)!)
let imgToShow = UIImage(data: imgData as Data)
where imgToShow is this what I expected. I mean, when debugging it's giving me the preview of this what I want. So I am sure that it's correct and not nil.
public func getImgData(id: Int) -> NSData{
let url = *
let imgUrl = URL(string: url)!
let imgData = NSData(contentsOf: imgUrl)!
return imgData
}
I would like to assign this imgToShow
to cell.img.image = imgToShow
but it's giving me an error:
Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
Can you please give me some advice where should I look the solution? Thank you in advance