khoren93 / flutter_zxing

Flutter plugin for scanning and generating QR codes using the ZXing library, supporting Android, iOS, and desktop platforms
https://pub.dev/packages/flutter_zxing
MIT License
98 stars 56 forks source link

I am having issue with QR scanning in iOS #92

Open indra58 opened 1 year ago

indra58 commented 1 year ago

This library working fine in android but not working in iOS. And, there is no such issues encountered already and after cloning this library I have verified example app in same devices and got same issue.

Library Version -->> 1.1.2

Test performed in

  1. iPhone 7
  2. iPhone 13 Pro

My implementation

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("QR Code Scanner")),
      body: Stack(
        children: [
          ReaderWidget(
            isMultiScan: false,
            codeFormat: Format.qrCode,
            showFlashlight: false,
            showGallery: false,
            showToggleCamera: false,
            allowPinchZoom: false,
            onControllerCreated: (controller) async {
              if (controller != null) {
                cameraController = controller;
              }
            },
            scannerOverlay: DynamicScannerOverlay(
                borderColor: Theme.of(context).primaryColor),
            onScan: (result) async {
              await cameraController.pausePreview();
              _showAlertDialog("QR Code \n${result.text}");
            },
          ),
        ],
      ),
    );
  }

There is no such information in logcat regarding issue of not scanning the QR codes

khoren93 commented 1 year ago

Hello,

I'm pleased to announce that version 1.2.0 is now available. This latest version has been released to address the iOS detection issue that some users have been experiencing.

To temporarily resolve the issue, I've downgraded the image version from v4.0 to v3.0. Please note that this is a temporary fix and a more permanent solution will be provided in the next releases.

If you encounter any issues or have any feedback about the new version, please let me know.

Thank you for your support!

Best regards, Khoren

jorg1piano commented 5 months ago

It seems like there is still an issue on iOS in version 1.5.2.

Scanning the same QR code on android works fine.

image

Qr code saying "Hello world"

  void _onImage(CameraImage image) async {
    Code code = await zx.processCameraImage(image);
    // works on android but on ios isValid is never true and code.text is always an empty string
    print(code);
  }

Running it on a iPhone 14 Pro Max with ios 17.3