Reading QR code makes the application to crash

jstuardojstuardo Member ✭✭

Hello,

I am using ZXing component to read QR code in an iOS application. For that, I added the ZXing.Net.Mobile package.

The method that actually scans the code is this:

        public async Task<bool> StartReadingAsync()
        {
            _codeList.Clear();

            var optionsCustom = new MobileBarcodeScanningOptions();
            optionsCustom.PossibleFormats.Add(ZXing.BarcodeFormat.QR_CODE);

            var scanner = new MobileBarcodeScanner()
            {
                TopText = "Escanee el código QR",
                BottomText = "Por favor, espere",
            };

            var scanResult = await scanner.Scan(optionsCustom);
            var code = scanResult?.Text;
            if (!String.IsNullOrEmpty(code))
                OnDataRead(code);

            OnDataReadStopped();
            return await Task.FromResult(true);
        }

When this instruction is executed: var scanResult = await scanner.Scan(optionsCustom) application crashes.

I have even added a try catch block to see the exception but it has no effect. Application simple closes.

I could see that this was saved in the log:

`2019-07-11 20:57:27.097 MyApp.iOS[831:109240] Starting to scan...
2019-07-11 20:57:27.157 MyApp.iOS[831:109240] ZXingScannerView.Setup() took 40,111 ms.
2019-07-11 20:57:27.157 MyApp.iOS[831:109240] StartScanning

=================================================================

Native Crash Reporting

Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries

used by your application.

=================================================================

Basic Fault Adddress Reporting

Memory around native instruction pointer (0x1bfd90dd0):0x1bfd90dc0 fd 7b c1 a8 c0 03 5f d6 30 41 80 d2 01 10 00 d4 .{.....0A......
0x1bfd90dd0 c3 00 00 54 fd 7b bf a9 fd 03 00 91 18 db ff 97 ...T.{..........
0x1bfd90de0 bf 03 00 91 fd 7b c1 a8 c0 03 5f d6 d0 03 80 d2 .....{....
.....
0x1bfd90df0 01 10 00 d4 c3 00 00 54 fd 7b bf a9 fd 03 00 91 .......T.{......

=================================================================

Native stacktrace:

0x101fb0144 - /var/containers/Bundle/Application/BB6D39A2-F4BA-405E-921F-8EBF5B8BA900/FinningApp.iOS.app/FinningApp.iOS : (null)
0x101fa6e80 - /var/containers/Bundle/Application/BB6D39A2-F4BA-405E-921F-8EBF5B8BA900/FinningApp.iOS.app/FinningApp.iOS : (null)
0x1bfe059ec - /usr/lib/system/libsystem_platform.dylib : <redacted>
0x1bfd8a924 - /usr/lib/system/libsystem_kernel.dylib : <redacted>
0x1bfd8a954 - /usr/lib/system/libsystem_kernel.dylib : fcntl
0x1c2f6cb50 - /System/Library/PrivateFrameworks/TCC.framework/TCC : <redacted>
0x1c2f6ca90 - /System/Library/PrivateFrameworks/TCC.framework/TCC : <redacted>
0x1c2f7092c - /System/Library/PrivateFrameworks/TCC.framework/TCC : <redacted>
0x1bfe58e88 - /usr/lib/system/libxpc.dylib : <redacted>
0x1bfe4c59c - /usr/lib/system/libxpc.dylib : <redacted>
0x1bfc35854 - /usr/lib/system/libdispatch.dylib : <redacted>
0x1bfbeee50 - /usr/lib/system/libdispatch.dylib : <redacted>
0x1bfbe6dfc - /usr/lib/system/libdispatch.dylib : <redacted>
0x1bfe15124 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
0x1bfe17cd4 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread`

Any help, please?

Thanks

Jaime

Best Answer

Answers

Sign In or Register to comment.