Closed danisk89 closed 1 year ago
isGoogleBarcodeScannerModuleAvailable
is not available on iOS, see documentation:
Only available on Android.
Therefore, you should call this method only on Android.
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.
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