QR code not recognizable in iOS
See original GitHub issueBelow 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:
- Created 3 years ago
- Comments:7 (2 by maintainers)

Top Related StackOverflow Question
Meanwhile, my personal solution: xamarin forms scanner
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.