We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If i try to start a new scan the plugin return me [error] - Error: Uncaught (in promise): Error: Not available on iOS
I want to use it on iOS. On Android is OK
https://github.com/robingenz/capacitor-mlkit-plugin-demo.git
async scan(): Promise<void> { await BarcodeScanner.requestPermissions(); // Check if the Google ML Kit barcode scanner is available await BarcodeScanner.isGoogleBarcodeScannerModuleAvailable().then(async (data) => { if (data.available) { // Start the barcode scanner await this.startScanner().then(async (barcodes) => { var code = barcodes[0].rawValue; console.log(code); }); } else { // Install the Google ML Kit barcode scanner await BarcodeScanner.installGoogleBarcodeScannerModule().then(async () => { await this.startScanner().then(async (barcodes) => { var code = barcodes[0].rawValue; console.log(code); }); }); } }); } async startScanner() { const { barcodes } = await BarcodeScanner.scan({ formats: [BarcodeFormat.QrCode, BarcodeFormat.Ean13] }); return barcodes; } async requestPermissions(): Promise<boolean> { const { camera } = await BarcodeScanner.requestPermissions(); return camera === 'granted' || camera === 'limited'; } async presentAlert(): Promise<void> { console.log("Non va"); }
No response
Latest Dependencies:
@capacitor/cli: 5.5.1 @capacitor/core: 5.5.1 @capacitor/android: 5.5.1 @capacitor/ios: 5.5.1
Installed Dependencies:
@capacitor/cli: 5.4.1 @capacitor/core: 5.4.1 @capacitor/ios: 5.4.1 @capacitor/android: 5.4.1
The text was updated successfully, but these errors were encountered:
isGoogleBarcodeScannerModuleAvailable is not available on iOS, see documentation:
isGoogleBarcodeScannerModuleAvailable
Only available on Android.
Therefore, you should call this method only on Android.
Sorry, something went wrong.
Ok, thank you so much. But if i want to use this plugin on ios, how to do? I tried on emulator and doesn't work
I am not quiet sure what you mean. You can just call the following method (for example) on iOS:
const scan = async () => { const { barcodes } = await BarcodeScanner.scan({ formats: [BarcodeFormat.QrCode], }); return barcodes; };
But you should call isGoogleBarcodeScannerModuleAvailable only on Android. Therefore just check the platform, see https://capacitorjs.com/docs/core-apis/web#getplatform
Ok thanks a lot!! Should it work on ios xcode emulator?
I haven't tried it.
No branches or pull requests
Plugin(s)
Did you test the latest version?
Platform(s)
Current behavior
If i try to start a new scan the plugin return me [error] - Error: Uncaught (in promise): Error: Not available on iOS
Expected behavior
I want to use it on iOS. On Android is OK
Reproduction
https://github.com/robingenz/capacitor-mlkit-plugin-demo.git
Steps to reproduce
Other information
No response
Capacitor doctor
Latest Dependencies:
@capacitor/cli: 5.5.1
@capacitor/core: 5.5.1
@capacitor/android: 5.5.1
@capacitor/ios: 5.5.1
Installed Dependencies:
@capacitor/cli: 5.4.1
@capacitor/core: 5.4.1
@capacitor/ios: 5.4.1
@capacitor/android: 5.4.1
Before submitting
The text was updated successfully, but these errors were encountered: