Invoking barcode scanner causes application crash on latest NativeScript ios platform (8.1.0)
See original GitHub issueWhen the barcode scanner is invoked, the application crashes on ios with the latest nativescript runtime.
NativeScript Info
✔ Component nativescript has 8.1.1 version and is up to date. ✔ Component @nativescript/core has 8.1.1 version and is up to date. ✔ Component @nativescript/ios has 8.1.0 version and is up to date.
Steps
- Create an example application with the barcode scanner implemented.
- configure beepOnScan to false.
- Invoke the barcode scanner.
The crash has something to do with the _addVolumeObserver.
Stack
2021-09-10 14:08:28.074065-0400 someapp[844:112105] 58 0x101978e68 tns::Tasks::Drain() + 104 2021-09-10 14:08:28.074274-0400 someapp[844:112105] 59 0x101973088 +[NativeScript start:] + 572 2021-09-10 14:08:28.074308-0400 someapp[844:112105] 60 0x100e877a0 main + 676 2021-09-10 14:08:28.074339-0400 someapp[844:112105] 61 0x186469cf8 <redacted> + 4 2021-09-10 14:08:28.074359-0400 someapp[844:112105] JavaScript stack trace: 2021-09-10 14:08:28.103018-0400 someapp[844:112105] at _addVolumeObserver (file:///app/vendor.js:146876:32)
Temporary fix:
if (scanner['_observer']) {
scanner['_observer']['_owner'] = undefined;
scanner['_observer'] = undefined;
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13
Top GitHub Comments
@tdhman It’s pretty gross and I am not proud of it, but you need to configure beepOnScan = false. Then create an instance of the barcode scanner class. Apply the properties to the class. I am using an angular service which wraps the scanner, but you don’t have to do that. The reason it works is because there is an _addVolumeObserver method which will return if there is no _observer. This is intended to be a temporary hack. Hopefully, @EddyVerbruggen can possibly take a look.
@EddyVerbruggen any update on this one?