barcode-scanner
barcode-scanner copied to clipboard
TO JS undefined
When i run on ionic6, it doesn't work. The xcode output shows "TO JS undefined", no matter use BarcodeScanner.hideBackground() or BarcodeScanner.startScan(). Is anyone also got this error?
I have no issues in with my ionic 6 test setup, the plugin works as expected in my case so it might be an issues with your setup and not the plugin itself.
Can you share a repo where I can reproduce your issue?
I'm getting this too. When looking at Xcode I can see a warning:
discoverCaptureDevices()' is deprecated: New Xcode? Check if
AVCaptureDevice.DeviceType has new types and add them accordingly.
Same here.
@ionic/vue v6.0.0 Capacitor v4.0.1 barcode-scanner v3.0.0
For me this was the issue.
In @capacitor-community/barcode-scanner/ios/Plugin/Plugin.swift
the UIApplication.shared.statusBarOrientation
was not just deprecated, but is obsolete. This line:
self.videoPreviewLayer?.connection?.videoOrientation = interfaceOrientationToVideoOrientation(UIApplication.shared.statusBarOrientation)
should be replaced to something like this
if let interfaceOrientation = UIApplication.shared.windows.first(where: { $0.isKeyWindow })?.windowScene?.interfaceOrientation {
self.videoPreviewLayer?.connection?.videoOrientation = interfaceOrientationToVideoOrientation(interfaceOrientation)
}
The TO JS undefined
log remains, but the barcode scanner seems to work.
I have gotten the same problem
Me too
Fixed in the current pre-release v5