Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

ZXing barcode scanner on iOS won't read barcodes

$
0
0

I'm working on a Xamarin Forms PCL project targeting Android and iOS that needs some basic barcode scanning functionality.

I got things up and running with the forms version of the ZXing.Net.Mobile package following this tutorial and referencing this guide and it works great on Android. However, on iOS the camera comes up but the OnScanResult event is never fired.

I've tested it on several iOS devices running several different versions (anywhere from 8.0 - 10.3) and fiddled with everything I can think of, referencing their sample projects as well. ZXing.Net.Mobile and ZXing.Net.Mobile.Forms nuget packages were installed in all projects.

Here's my scanner code, triggered from a button press on my main page:

var scanPage = new ZXingScannerPage();

scanPage.OnScanResult += (result) =>
{
    scanPage.IsScanning = false;

    Device.BeginInvokeOnMainThread(async () =>
    {
        await Navigation.PopAsync();
        await DisplayAlert("Scanned Barcode", result.Text, "OK");
    });
};

await Navigation.PushAsync(scanPage);

and AppDelegate.cs:

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    global::Xamarin.Forms.Forms.Init();

    global::ZXing.Net.Mobile.Forms.iOS.Platform.Init();

    LoadApplication(new App());

    return base.FinishedLaunching(app, options);
}

After two days of fighting with this, I feel like I'm at my wit's end. Has anyone else encountered similar problems? Thanks for any guidance!


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>