Post

Replies

Boosts

Views

Created

Decoding QR Codes via CIDetector is broken on a simulator running iOS 14.4
I was always using this snippet to import an qr image to decode it. On the simulator running iOS 14.4 qrDetector?.features... returns nil, while the same image on a device returns proper output. Any thoughts about this? Should I use different methods or is this just a possible simulator bug? I saw that iOS 14.4 brings improvements to QR codes and Bluetooth audio guard let ciImage = CIImage(image: image) else { return nil } let detectorOptions = [CIDetectorAccuracy: CIDetectorAccuracyHigh] let qrDetector = CIDetector(ofType: CIDetectorTypeQRCode, context: CIContext(), options: detectorOptions) let decoderOptions = [CIDetectorImageOrientation: ciImage.properties[(kCGImagePropertyOrientation as String)] ?? 1] let features = qrDetector?.features(in: ciImage, options: decoderOptions) return (features?.first as? CIQRCodeFeature)?.messageString
1
0
1.3k
Feb ’21