Unable to cast UIImage in swift iOS 8 Extension

后端 未结 3 1147
终归单人心
终归单人心 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:10

    Getting image as

    , {100, 100}
    

    It cannot be casted as NSURL and getting nil in the following expression.

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

提交回复
热议问题