ionic-team / capacitor-barcode-scanner

https://capacitorjs.com/docs/apis/barcode-scanner
MIT License
14 stars 14 forks source link

Error on ios #8

Open VladCXT opened 6 months ago

VladCXT commented 6 months ago

Hi, I am running into this error on IOS (android works totally fine):

⚡️ To Native -> CapacitorBarcodeScanner scanBarcode 47961097 ERROR MESSAGE: {"errorMessage":"Error decoding scan arguments","message":"Error decoding scan arguments"} ⚡️ [error] - {"errorMessage":"Error decoding scan arguments","message":"Error decoding scan arguments"} ⚡️ [error] - ERROR

CapacitorBarcodeScanner.scanBarcode({hint: CapacitorBarcodeScannerTypeHintALLOption.ALL}).then(({ScanResult}: CapacitorBarcodeScannerScanResult) => { console.log('ScanResult', ScanResult) })

jcesarmobile commented 6 months ago

I think it's fixed in version 1.0.1, can you update and try again?

lucaBellomo commented 5 months ago

Hi, I'm running into the same error with the version 1.0.1. Is there anything I can try?

jcesarmobile commented 5 months ago

you could provide a sample app that reproduces the problem as I can't reproduce with 1.0.1

lucaBellomo commented 5 months ago

Hi, thank you for the response. I found the solution: I was using the plugin the old way (window.Capacitor.Plugins.CapacitorBarcodeScanner) and it worked on Android but not on iOS. Importing the plugin import { CapacitorBarcodeScanner} from '@capacitor/barcode-scanner';

it works as expected.

ToKruAmApp commented 3 months ago

I'm running into the same error and unfortunately in my use case importing the plugin is not an option which means it has to be called via the window object. Is there anything I can do or at least a hint what may cause this?