Unable to cast UIImage in swift iOS 8 Extension

后端 未结 3 1142
终归单人心
终归单人心 2021-01-02 10:48

I have a strange problem, I am trying to build an action extension that will scan barcode from the image provided. Here is the code.

override func viewDidLoa         


        
3条回答
  •  庸人自扰
    2021-01-02 11:25

    the thing is that image is not UIImage, it's NSURL.

    Change code to this one:

    imageView.image = UIImage(data: NSData(contentsOfURL: image as NSURL)!)!
    

提交回复
热议问题