0

I have a problem building Xamarin Forms app. We need to implement barcode scanner in it where I found several tutorials how to integrate ZXing.Net.Mobile.Platforms which I installed for all project via Nuget - I tried latest stable version (2.4.1) as also latest beta version (3.1.0-beta2)

I read readme file so I added permission request to Info.plist and I also added Init call to AppDeledate.cs

When I call method scanner.Scan(); the scanner opens up and show scanner but it never detects any code.

My code is:

PermissionStatus status = await Permissions.RequestAsync<Permissions.Camera>();
            if (status == PermissionStatus.Granted)
            {
                MobileBarcodeScanner scanner = new MobileBarcodeScanner();

                MobileBarcodeScanningOptions mobileBarcodeScanningOptions = new ZXing.Mobile.MobileBarcodeScanningOptions();
                mobileBarcodeScanningOptions.TryHarder = true;
                mobileBarcodeScanningOptions.AutoRotate = true;
                mobileBarcodeScanningOptions.TryInverted = true;
                mobileBarcodeScanningOptions.UseNativeScanning = true;
                mobileBarcodeScanningOptions.DisableAutofocus = false;
                mobileBarcodeScanningOptions.CameraResolutionSelector = (res) => { return res.Last(); };
                mobileBarcodeScanningOptions.PossibleFormats = new List<ZXing.BarcodeFormat>
                {
                    ZXing.BarcodeFormat.QR_CODE,
                    ZXing.BarcodeFormat.EAN_13
                };
                scanner.ResumeAnalysis();
                var result = await scanner.Scan(mobileBarcodeScanningOptions);

                if (result != null)
                    Console.WriteLine("Scanned Barcode: " + result.Text);
            }

I tried this on iPhone 13 (iOS 16) and iPhone 11 (iOS 15.4) but it is not working on any of them.

Barcode scanner is working fine on all Android device we have tested but not luck on iOS.

What I noted in output window after starting scanner is:

2022-09-18 20:27:10.905 Xamarin.PreBuilt.iOS[6680:656924] Starting to scan...

2022-09-18 20:27:10.981 Xamarin.PreBuilt.iOS[6680:656924] ZXingScannerView.Setup() took 68.001 ms. 2022-09-18 20:27:10.981 Xamarin.PreBuilt.iOS[6680:656924] StartScanning

Thread started: #9

================================================================= Native Crash Reporting

Got a segv while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

================================================================= Native stacktrace:

0x1044d8288 - /private/var/containers/Bundle/Application/E002FFE8-ADDD-4163-90D0-43B001F6763F/DelovniCas.iOS.app/Xamarin.PreBuilt.iOS : mono_dump_native_crash_info

0x1044cecd8 - /private/var/containers/Bundle/Application/E002FFE8-ADDD-4163-90D0-43B001F6763F/DelovniCas.iOS.app/Xamarin.PreBuilt.iOS : mono_handle_native_crash

0x1044dbc58 - /private/var/containers/Bundle/Application/E002FFE8-ADDD-4163-90D0-43B001F6763F/DelovniCas.iOS.app/Xamarin.PreBuilt.iOS : mono_sigsegv_signal_handler_debug
0x2103cda90 - /usr/lib/system/libsystem_platform.dylib : <redacted>

0x1046651ec - /private/var/containers/Bundle/Application/E002FFE8-ADDD-4163-90D0-43B001F6763F/DelovniCas.iOS.app/Xamarin.PreBuilt.iOS : xamarin_collapse_struct_name
0x10467220c - /private/var/containers/Bundle/Application/E002FFE8-ADDD-4163-90D0-43B001F6763F/DelovniCas.iOS.app/Xamarin.PreBuilt.iOS : _ZL15param_iter_next14IteratorActionPvPKcmS0_PS0_

0x10466af14 - /private/var/containers/Bundle/Application/E002FFE8-ADDD-4163-90D0-43B001F6763F/DelovniCas.iOS.app/Xamarin.PreBuilt.iOS : xamarin_invoke_trampoline
0x1046720d0 - /private/var/containers/Bundle/Application/E002FFE8-ADDD-4163-90D0-43B001F6763F/DelovniCas.iOS.app/Xamarin.PreBuilt.iOS : xamarin_arch_trampoline
0x104672d74 - /private/var/containers/Bundle/Application/E002FFE8-ADDD-4163-90D0-43B001F6763F/DelovniCas.iOS.app/Xamarin.PreBuilt.iOS : xamarin_arm64_common_trampoline
0x1dc86c2d0 - /System/Library/PrivateFrameworks/AVFCapture.framework/AVFCapture : <redacted>
0x1dc86c19c - /System/Library/PrivateFrameworks/AVFCapture.framework/AVFCapture : <redacted>

0x1df91efd0 - /System/Library/PrivateFrameworks/CMCapture.framework/CMCapture : <redacted>
0x1dfae30fc - /System/Library/PrivateFrameworks/CMCapture.framework/CMCapture : <redacted>
0x1cafbdfdc - /usr/lib/system/libdispatch.dylib : <redacted>
0x1cafc146c - /usr/lib/system/libdispatch.dylib : <redacted>
0x1cafd4a58 - /usr/lib/system/libdispatch.dylib : <redacted>
0x1cafc556c - /usr/lib/system/libdispatch.dylib : <redacted>
0x1cafc61e0 - /usr/lib/system/libdispatch.dylib : <redacted>
0x1cafd0e10 - /usr/lib/system/libdispatch.dylib : <redacted>
0x210460df8 - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread
0x210460b98 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread

================================================================= Basic Fault Address Reporting

Memory around native instruction pointer (0x1046650b0):0x1046650a0 a8 83 5e f8 1f 01 00 39 01 00 00 14 a8 03 5f f8 ..^....9....... 0x1046650b0 08 01 40 39 a8 10 00 34 01 00 00 14 a8 03 5f f8 ..@9...4....... 0x1046650c0 08 01 c0 39 08 8d 00 71 e8 13 00 f9 08 69 01 f1 ...9...q.....i.. 0x1046650d0 c8 0c 00 54 eb 13 40 f9 0a 00 00 90 4a c1 0c 91 ...T..@.....J...

================================================================= Managed Stacktrace:

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

But I do not know how to resolve this problem. Any help will be highly appreciated.

  • 1
    it doesn't appear that there have been any updates to the package in several years. There are several discussion about iOS issues here: https://github.com/Redth/ZXing.Net.Mobile/issues – Jason Sep 18 '22 at 18:39

0 Answers0