question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

QR code not recognizable in iOS

See original GitHub issue

Below is the working code for an Android QR scanner. In iOS I tried different combinations of AutoRotate, TryHarder, TryInverted, DelayBetweenContinuousScans and DelayBetweenAnalyzingFrames but with no result. Removing the QR_CODE format from options, iOS is able to scan eg EAN_13 but never QR_CODE.

Page view: <Grid> <zxing:ZXingScannerView x:Name="zxing" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" OnScanResult="zxing_OnScanResult"/> <zxing:ZXingDefaultOverlay x:Name="overlay" TopText = "Hold your phone up to the barcode" BottomText = "Scanning will happen automatically" ShowFlashButton="True" FlashButtonClicked="overlay_FlashButtonClicked"/> </Grid>

Page code: `[XamlCompilation(XamlCompilationOptions.Compile)] public partial class PageScan : ContentPage { public PageScan() { InitializeComponent(); }

protected override void OnAppearing()
{
	base.OnAppearing();

	zxing.IsAnalyzing = true;
	zxing.IsScanning = true;
	zxing.Options = new MobileBarcodeScanningOptions
	{
		PossibleFormats = new List<ZXing.BarcodeFormat>() { ZXing.BarcodeFormat.QR_CODE },
		//DelayBetweenContinuousScans = 20,
		//DelayBetweenAnalyzingFrames = 20,
		DisableAutofocus = false,
		//AutoRotate = false,
		TryHarder = true,
		//TryInverted = false,
		UseFrontCameraIfAvailable = false,
		//AssumeGS1 = true,
		//UseNativeScanning = true
	};
}

protected override void OnDisappearing()
{
	zxing.IsScanning = false;

	base.OnDisappearing();
}

private void zxing_OnScanResult(ZXing.Result result)
{
	zxing.IsAnalyzing = false;

	Device.BeginInvokeOnMainThread(async () =>
	{
		Console.WriteLine("QRPAGE | " + result.Text + " " + result.BarcodeFormat);
		await Navigation.PushAsync(new PageResult(result.Text));
		await DisplayAlert("Qr scan result", result.Text, "OK");
	});
}

private async void overlay_FlashButtonClicked(Button sender, EventArgs e)
{
	if (Device.RuntimePlatform == Device.iOS)
	{
		//workaround for iOS torch
		await ToggleFlashIos();
	}
	else
	{
		zxing.IsTorchOn = !zxing.IsTorchOn;
	}
}

}`

iOS version of my iPhone7 13.3.1 Xamarin.Forms 4.8 Xamarin.Essentials 1.5 ZXing.Net.Mobile & ZXing.Net.Mobile.Forms 3.0.0-beta5

Any suggestions?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
AndreaGobscommented, Jan 28, 2021

Meanwhile, my personal solution: xamarin forms scanner

2reactions
chuckgiddenscommented, Dec 6, 2020

I have the same issue with same versions of iOS as above. Tried latest stable and beta versions and works fine in Android but not iOS. The camera works but the QRCode never is read in iOS. But perfect in Android.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Top 3 Ways to Fix QR Code Scanner Not Working On iPhone
1. Enable QR Code Scanner in Camera Settings. You can quickly scan a QR code by pointing your iPhone's camera towards it. If...
Read more >
Unable to scan QR Code via Camera
After you upgrade to iOS 14.3 ... go into Settings on your phone and from the General menu search for the word 'Code'...
Read more >
Fixed: QR Code Not Working on iPhone after iOS 16 Update
Are you trying to scan a QR code using your iPhone, but the QR code not working after update? This troubleshooting guide has...
Read more >
Issues with scanning the QR code using iOS devices
Navigate to Settings -> Camera -> Scan QR code. Check if the option is disabled, if disabled, enable it and try scanning the...
Read more >
Can't Scan QR Codes with iPhone / iPad Camera? Here's ...
For many users, the QR code scanning feature is disabled for whatever reason on their device camera, so simply turning it back on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found