capawesome-team / capacitor-mlkit

⚡️ ML Kit plugins for Capacitor. Supports Android and iOS.
https://capawesome.io/plugins/mlkit/
Apache License 2.0
141 stars 39 forks source link

bug: Camera opening error #187

Open ilsanto17 opened 1 day ago

ilsanto17 commented 1 day ago

Plugin(s)

Version

6.1.0

Platform(s)

Current behavior

When I click on the button to open the camera in iOS, after asking for permissions, I get the error I attach below. The camera does not open. On Android it works perfectly

startScan = async () => {
    try {
      document.querySelector('body')?.classList.add('barcode-scanner-active');

      // Usa NgZone per eseguire il codice fuori dal ciclo di rilevamento del cambiamento di Angular
      this.zone.runOutsideAngular(async () => {
        const listener = await BarcodeScanner.addListener('barcodeScanned', async result => {
          console.log("Barcode scanned:", result);
        });

        await BarcodeScanner.startScan();
      });
    } catch (error) {
      console.error("Error during scan:", error);
    }
  };
startScan = async () => {
    try {
      document.querySelector('body')?.classList.add('barcode-scanner-active');

      // Usa NgZone per eseguire il codice fuori dal ciclo di rilevamento del cambiamento di Angular
      this.zone.runOutsideAngular(async () => {
        const listener = await BarcodeScanner.addListener('barcodeScanned', async result => {
          console.log("Barcode scanned:", result);
        });

        await BarcodeScanner.startScan();
      });
    } catch (error) {
      console.error("Error during scan:", error);
    }
  };
To Native ->  BarcodeScanner addListener 107025623
⚡️  To Native ->  BarcodeScanner startScan 107025624
Thread Performance Checker: -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness
PID: 1804, TID: 248741
Backtrace
=================================================================
3   CapacitorCommunityBarcodeScanner    0x0000000103b58ed8 $s32CapacitorCommunityBarcodeScanner0cD0C4scan33_E9781981B91FA2D5C67BE1318BC971C3LLyyFyyScMYccfU1_ + 484
4   CapacitorCommunityBarcodeScanner    0x0000000103b577c8 $sIeg_IeyB_TR + 48
5   libdispatch.dylib                   0x000000010448cb98 _dispatch_call_block_and_release + 32
6   libdispatch.dylib                   0x000000010448e7bc _dispatch_client_callout + 20
7   libdispatch.dylib                   0x000000010449ed58 _dispatch_main_queue_drain + 1084
8   libdispatch.dylib                   0x000000010449e90c _dispatch_main_queue_callback_4CF + 44
9   CoreFoundation                      0x000000019e17b710 76A3B198-3C09-323E-8359-0D4978E156F5 + 354064
10  CoreFoundation                      0x000000019e178914 76A3B198-3C09-323E-8359-0D4978E156F5 + 342292
11  CoreFoundation                      0x000000019e177cd8 CFRunLoopRunSpecific + 608
12  GraphicsServices                    0x00000001e2bc51a8 GSEventRunModal + 164
13  UIKitCore                           0x00000001a07b1ae8 9DA0D273-5506-3712-B73D-E0149D74C13C + 4238056
14  UIKitCore                           0x00000001a0865d98 UIApplicationMain + 340
15  App.debug.dylib                     0x0000000104dccf84 __debug_main_executable_dylib_entry_point + 64
16  dyld                                0x00000001c194f154 52039C94-4DA1-3638-BD52-020A0B5FA399 + 250196
⚡️  To Native ->  BarcodeScanner addListener 107025625
⚡️  To Native ->  BarcodeScanner startScan 107025626

Expected behavior

Camera opening

Reproduction

.

Steps to reproduce

.

Other information

No response

Capacitor doctor

Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.1.2 @capacitor/core: 6.1.2 @capacitor/android: 6.1.2 @capacitor/ios: 6.1.2

Installed Dependencies:

@capacitor/cli: 6.1.2 @capacitor/android: 5.5.0 @capacitor/core: 6.1.2 @capacitor/ios: 6.1.2

[success] iOS looking great! 👌 [success] Android looking great! 👌

Before submitting

github-actions[bot] commented 1 day ago

This issue has been labeled as needs: reproduction. This label is added to issues that need a code reproduction.

Please provide a Minimal, Reproducible Example using this template in a public GitHub repository so we can debug the issue.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for us to reproduce the issue.