Post

Replies

Boosts

Views

Activity

I can't show QR in Image View
Hi everyone, i need your help please, i have a code that generates a QR when you push a button and shows the generated QR in an Image View, it works in the simulator but when i connect my iphone and test my code instead of the QR it shows a black square, but in the console there aren't any errors. Also, when I put the code that generates the QR in the viewDidLoad() function instead of the Button function, it works ok in my iphone. Im sure that the QR its being generated because I have a sharing button and when I push it and share the QR it does share it just fine, the QR shows correctly. Here is my code, the one that generates and shows the QR. @IBAction func VerQR(_ sender: Any) {     if idQr != nil{       let residente = "3473532/MY/" + idQr       let data = residente.data(using: .ascii, allowLossyConversion: false)       filter = CIFilter(name: "CIQRCodeGenerator")       filter.setValue(data, forKey: "inputMessage")       let transform = CGAffineTransform(scaleX: 10, y: 10)       let image = UIImage(ciImage: filter.outputImage!.transformed(by: transform))       imagenQR.image = image     }   } Here is the code that shares the QR @IBAction func compartirBtn(_ sender: UIButton) {       let image = imagenQR.image       let imageToShare = [image!]       let activityViewController = UIActivityViewController(activityItems: imageToShare, applicationActivities: nil)       activityViewController.popoverPresentationController?.sourceView = self.view       self.present(activityViewController, animated: true, completion: nil)
2
0
780
May ’21