EddyVerbruggen / nativescript-barcodescanner

πŸ”Ž NativeScript QR / barcode (bulk)scanner plugin
MIT License
293 stars 73 forks source link

Crash on scan (NS7) #251

Closed ethnovode closed 3 years ago

ethnovode commented 4 years ago

Hey guys,

When I hit scan on my app it crashes with the following log :

container_system_group_path_for_identifier: success Got system group container path from MCM for systemgroup.com.apple.configurationprofiles: /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles NativeScript caught signal 11. Native Stack: 1 0x10121f018 sig_handler(int) 2 0x1ee37e290 <redacted> 3 0x10119d664 NativeScript::NSObjectAlloc(JSC::ExecState*) 4 0x101d477cc llint_entry 5 0x101d44f28 llint_entry 6 0x101d45ed4 llint_entry 7 0x101d265e8 vmEntryToJavaScript 8 0x1012d4e48 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 9 0x1019ebe20 JSC::boundThisNoArgsFunctionCall(JSC::ExecState*) 10 0x101d477cc llint_entry 11 0x101d44f28 llint_entry 12 0x101d265e8 vmEntryToJavaScript 13 0x1012d4e48 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 14 0x1019ebe20 JSC::boundThisNoArgsFunctionCall(JSC::ExecState*) 15 0x101d477cc llint_entry 16 0x101d4636c llint_entry 17 0x101d44f28 llint_entry 18 0x101d44f28 llint_entry 19 0x101d44f28 llint_entry 20 0x101d265e8 vmEntryToJavaScript 21 0x1012d4e48 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) 22 0x10120f8e8 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::callFunction(JSC::JSValue const&, JSC::ArgList const&, void*) 23 0x10120f2f4 NativeScript::ObjCMethodCallback::ffiClosureCallback(void*, void**, void*) 24 0x101210428 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*) 25 0x101d7b388 ffi_closure_SYSV_inner 26 0x101d7c1b4 .Ldo_closure 27 0x1a7460e54 <redacted> 28 0x1a746a7b8 <redacted> 29 0x1a74673f4 <redacted> 30 0x1a746696c <redacted> 31 0x1a745aa98 <redacted> JS Stack: alloc([native code]) at BarcodeScanner(file: app/libs/nativescript-barcodescanner/barcodescanner.ios.js:75:29) at scan(file: app/components/Checkout/ProductGrid.vue:349:0) at scan([native code]) at startScanning(file: app/components/Checkout/ProductGrid.vue:344:0) at startScanning([native code]) at invokeWithErrorHandling(file: node_modules/nativescript-vue/dist/index.js:1862:31) at _executeCallback(file: app/packages/core/ui/gestures/index.ios.ts:280:22) at file: app/packages/core/ui/gestures/index.ios.ts:137:29 at file:///app/vendor.js:30785:20 at UIApplicationMain([native code]) at run(file: app/packages/core/application/index.ios.ts:391:20) at file: node_modules/nativescript-vue/dist/index.js:12531:23 at file:///app/bundle.js:24824:10 at ./main.js(file:///app/bundle.js:24828:34) at __webpack_require__(file: app/webpack/bootstrap:74:0) at checkDeferredModules(file: app/webpack/bootstrap:43:0) at webpackJsonpCallback(file: app/webpack/bootstrap:30:0) at anonymous(file:///app/bundle.js:2:61) at evaluate([native code]) at moduleEvaluation at at asyncFunctionResume at at promiseReactionJob

I disabled 'beepOnScan'. It doesn't crash on the simulator, only on a real device. Any idea ?

delanick commented 4 years ago

Mine just crashes on iOS, using NS7 Core. But NS7 isn't logging the device console to terminal so I have no idea what the issue is - just crashes on scan attempt.

jessorlisa commented 4 years ago

Same issue here.

Environment

beepOnScan is set to false as well.

On some occasions there is no console output, on some there is. I think the native stack is the same as @ethnovode provided. However I am using the Angular flavour, not Vue.

Got system group container path from MCM for systemgroup.com.apple.configurationprofiles: /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
NativeScript caught signal 11.
Native Stack:
1   0x100c7f018 sig_handler(int)
2   0x1b77d9884 <redacted>
3   0x100bfd664 NativeScript::NSObjectAlloc(JSC::ExecState*)
4   0x1017a77cc llint_entry
5   0x1017a4f28 llint_entry
6   0x1017a5ed4 llint_entry
7   0x1017a4f28 llint_entry
8   0x1017a5ed4 llint_entry
9   0x1017a4f28 llint_entry
10  0x1017a4f28 llint_entry
11  0x1017a4e80 llint_entry
12  0x1017a636c llint_entry
13  0x1017a4e80 llint_entry
14  0x1017a4e80 llint_entry
15  0x1017a4e80 llint_entry
16  0x1017a4f28 llint_entry
17  0x1017a4e80 llint_entry
18  0x1017a4e80 llint_entry
19  0x1017a4e80 llint_entry
20  0x1017865e8 vmEntryToJavaScript
21  0x100d34e48 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
22  0x100c6f8e8 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::callFunction(JSC::JSValue const&, JSC::ArgList const&, void*)
23  0x100c6f2f4 NativeScript::ObjCMethodCallback::ffiClosureCallback(void*, void**, void*)
24  0x100c70428 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
25  0x1017db388 ffi_closure_SYSV_inner
26  0x1017dc1b4 .Ldo_closure
27  0x1bbb7878c <redacted>
28  0x1bb588fc8 <redacted>
29  0x1bb589320 <redacted>
30  0x1bb588344 <redacted>
31  0x1bb74a018 <redacted>
JS Stack:
alloc([native code])
at BarcodeScanner(file: node_modules/nativescript-barcodescanner/barcodescanner.ios.js:75:0)
at file: src/app/services/scanner/scanner.service.tns.ts:26:30
at ZoneAwarePromise(file: node_modules/@nativescript/zone-js/zone-nativescript.js:909:0)
at scan(file: src/app/services/scanner/scanner.service.tns.ts:24:27)
at scan(file: src/app/pages/search/components/search/search.component.tns.ts:402:32)
at executeListenerWithErrorHandling(file: node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:15225:0)
at wrapListenerIn_markDirtyAndPreventDefault(file: node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:15260:0)
at file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:2880:0
at onInvoke(file: node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:27504:0)
at file: node_modules/@nativescript/zone-js/zone-nativescript.js:140:0
at zonedCallback(file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:2879:0)
at _handleEvent(file: node_modules/@nativescript/core/data/observable/index.js:231:0)
at notify(file: node_modules/@nativescript/core/data/observable/index.js:214:0)
at _emit(file: node_modules/@nativescript/core/data/observable/index.js:254:0)
at file: node_modules/@nativescript/core/ui/button/index.ios.js:254:28
at UIApplicationMain([native code])
at run(file: node_modules/@nativescript/core/application/index.ios.js:331:0)
at bootstrapNativeScriptApp(file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:733:19)
at bootstrapApp(file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:624:0)
at bootstrapModule(file: node_modules/@nativescript/angular/__ivy_ngcc__/fesm2015/nativescript-angular.js:605:0)
at ./main.tns.ts(file:///app/bundle.js:8311:108)
at __webpack_require__(file:///app/run<\M-b\M^@\M-&>
ethnovode commented 4 years ago

On some occasions there is no console output, on some there is. I think the native stack is the same as @ethnovode provided. However I am using the Angular flavour, not Vue.

Exact same stack with Vue.

Here are my dependencies from package.json :

"dependencies": {
    "@nativescript/core": "^7.0.13",
    "@nativescript/firebase": "^11.1.2",
    "@nativescript/iqkeyboardmanager": "^2.0.0",
    "@nativescript/theme": "^2.5.0",
    "@nativescript/unit-test-runner": "^1.0.2",
    "@nstudio/nativescript-filterable-listpicker": "^3.0.0",
    "@nstudio/nativescript-pulltorefresh": "^3.0.1",
    "accounting": "^0.4.1",
    "axios": "^0.20.0",
    "i18n-postal-address": "^0.2.0",
    "nativescript-appversion": "^1.4.4",
    "nativescript-barcodescanner": "file:app/libs/nativescript-barcodescanner",
    "nativescript-fingerprint-auth": "^7.0.2",
    "nativescript-localize": "^4.2.2",
    "nativescript-numeric-keyboard": "^5.0.0",
    "nativescript-permissions": "^1.3.11",
    "nativescript-print-star": "file:app/libs/nativescript-print-star",
    "nativescript-ui-listview": "^9.0.4",
    "nativescript-vue": "^2.8.2",
    "vuex": "^3.5.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.7",
    "@babel/preset-env": "^7.12.7",
    "@nativescript/ios": "6.5.3",
    "@nativescript/types": "^7.0.4",
    "@nativescript/webpack": "^3.0.8",
    "@types/node": "^12.19.6",
    "@types/qunit": "^2.9.6",
    "babel-loader": "^8.1.0",
    "karma": "5.2.3",
    "karma-nativescript-launcher": "0.4.0",
    "karma-qunit": "4.1.1",
    "karma-webpack": "3.0.5",
    "nativescript-vue-template-compiler": "^2.8.2",
    "nativescript-worker-loader": "^0.12.1",
    "node-sass": "^4.14.1",
    "qunit": "2.12.0",
    "typescript": "^3.4.3",
    "vue": "^2.6.12",
    "vue-loader": "^15.9.5"
  },
jessorlisa commented 4 years ago

I did a quick test with the new v8 runtime (β”œβ”€β”€ @nativescript/ios@7.0.6), there seems to be no issue.

However there are too many other issues regarding the v8 runtime so it is not an option to upgrade right now, at least not for me.

Any chance we can get this working for the JSC runtime? Or do we need to use another version of this plugin?

From the README:

πŸ’‘ Plugin version 4.0.0+ is compatible with NativeScript 7+. If you need to target older NativeScript versions, please stick to plugin version 3.4.2.

As I understand it we have to use version 4.0.0+ with the NativeScript 7+ (interpreted as the core version) no matter which runtime we use. According to @NathanWalker the JSC runtime is fully compatible with {N} 7.

jessorlisa commented 4 years ago

Update: Working combinations for iOS:

Test on Android shows that nativescript-barcodescanner@3.4.2 is also working with @nativescript/android@7 as it seems (which I did not expect to be honest!):

β”œβ”€β”€ nativescript@7.0.11
β”œβ”€β”€ @nativescript/core@7.0.13
β”œβ”€β”€ @nativescript/android@7.0.1
β”œβ”€β”€ nativescript-barcodescanner@3.4.2

Can anybody confirm my observations? If so the README should be updated.

ethnovode commented 4 years ago

Like you I can't distribute my app with v8 as the launch time of the app is too long and iOS says no.

I confirm that your first scenario (v.3.4.2 with NS7 and JSC) is working on my iPhone iOS14.2. Great find! Thanks for sharing.

two-bridges commented 3 years ago

@jessorlisa FYI, v8 runtime did not work for me with those settings

{N} 7 with v8 runtime:

β”œβ”€β”€ nativescript@7.0.11
β”œβ”€β”€ @nativescript/core@7.0.13
β”œβ”€β”€ @nativescript/ios@7.0.6
β”œβ”€β”€ nativescript-barcodescanner@4.0.1

I still get a crash with the final log:

Got system group container path from MCM for systemgroup.com.apple.configurationprofiles: /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
two-bridges commented 3 years ago

@jessorlisa I can confirm that ios 6.5.3 does work for me at least

{N} 7 with JSC runtime:

β”œβ”€β”€ nativescript@7.0.11
β”œβ”€β”€ @nativescript/core@7.0.13
β”œβ”€β”€ @nativescript/ios@6.5.3
β”œβ”€β”€ nativescript-barcodescanner@4.0.1

THANK YOU for suggesting this, it saved me.

gabrielbiga commented 3 years ago

Hello all. Here the attribute "beepOnScan" worked on iOS 14 and V8 untime.

{N} 7 with V8 runtime:

β”œβ”€β”€ nativescript@7.0.11
β”œβ”€β”€ @nativescript/core@7.0.7
β”œβ”€β”€ @nativescript/ios@7.0.3
β”œβ”€β”€ nativescript-barcodescanner@4.0.1

Code:

export class QRCodeService
{
    private barcodeScanner: BarcodeScanner = new BarcodeScanner();

    /**
     * Open an pop-up to scan QR Codes.
     *
     * @param [options] Optional options that override defaults
     */
    public scan(options?: ScanOptions): Observable<ScanResult>
    {
        return from(this.barcodeScanner.scan({
            formats: 'QR_CODE',
            ...options,
            beepOnScan: false // Solves the crash
        }));
    }
}
two-bridges commented 3 years ago

Hello all, I have re-tested with @nativescript/ios@7.xtoday because I want to upgrade from 6.5x.

TLDR: barcodescanner on iOS V8 now works for Release but still not Debug.

Here are my settings (beepOnScan seems to have no effect):

{N} 7 with V8 runtime:

β”œβ”€β”€ nativescript@7.2.0
β”œβ”€β”€ @nativescript/core@7.2.1
β”œβ”€β”€ @nativescript/ios@7.2.0
β”œβ”€β”€ nativescript-barcodescanner@4.0.1
shanxp commented 3 years ago

Hi guys, do we have any update on this as it crashes on our environment too. beepOnScan flag doesn't seem to resolving the crash. iOS 14.4.1 Nativescript 7.2.0 Barcodescanner 4.0.1

Any help is appreciated.

Many thanks.

two-bridges commented 3 years ago

@shanxp I use these settings, with success:

β”œβ”€β”€ nativescript@7.2.0 (or higher)
β”œβ”€β”€ @nativescript/core@7.1.4 (or higher)
β”œβ”€β”€ @nativescript/ios@6.5.4 (NO HIGHER)
β”œβ”€β”€ nativescript-barcodescanner@4.0.1

@nativescript/ios has been re-written between 6.5.4 and 7.x.

shanxp commented 3 years ago

@two-bridges thanks very much for your reply. I have reverted from v4.0.1 to v3.4.2 as our iOS platform is still on v6.5.4 due to memory issues in the latest iOS platform version. All looks good now. Many thanks.

EddyVerbruggen commented 3 years ago

FYI the beepOnScan issue has been fixed - available in 4.1.0 now.