Forum Xamarin.Forms

zxing QR Scanner not detecting Camera in ios

AMNishanthiKumariAMNishanthiKumari USMember ✭✭✭
edited June 2019 in Xamarin.Forms

I have a cross platform project. I need to scan QR code using zxing. I have tried this code. scan page is openinng but camera not detecting in iOS.

This is Main page Code

`using System;
using Xamarin.Forms;
using ZXing.Net.Mobile.Forms;

namespace QRCOdes
public partial class MainPage : ContentPage
public MainPage()

    private void Button_Clicked(object sender, EventArgs e)
        var scan = new ZXingScannerPage();
        scan.OnScanResult += (result) =>
             Device.BeginInvokeOnMainThread(async () =>
                 await Navigation.PopAsync();
                 mycode.Text = result.Text;


Is there anything special to do ios project?


Best Answers


  • AMNishanthiKumariAMNishanthiKumari USMember ✭✭✭

    @LucasZhang Thank you I added your code to info.plist. But nothing happened. cam screen is white.

  • AMNishanthiKumariAMNishanthiKumari USMember ✭✭✭

    @LucasZhang said:
    Did you add the following code in Appdelegate.cs in iOS project?


    Thank you very much i added it. now working fine. (Y)

  • MichaelOBMichaelOB Member ✭✭

    I'm having a similar problem in iOS. The scanner appears, but it is not enabled - white screen. I have made the changes which you recommended. It behaves as if it were not enabled?

    Note that the flash button works fine.
    Note that it works perfectly in Android.

    My scanner initialization code:

        zxingControl = new ZXingScannerView
          HorizontalOptions = LayoutOptions.Center,
          VerticalOptions = LayoutOptions.FillAndExpand,
          AutomationId = "zxingScannerView",
          IsEnabled = true
        zxingControl.OnScanResult += (result) => Device.BeginInvokeOnMainThread(async () =>
        { // Stop analysis until we navigate away so we don't keep reading barcodes
          zxingControl.IsAnalyzing = false;
          ScanStr = result.Text;
          await ProcessScan();
        zxOverlay = new ZXingDefaultOverlay
          TopText = "Scan Barcode",
          BottomText = "Position Barcode in Window",
          ShowFlashButton = true, // zxingControl.HasTorch,
          AutomationId = "zxingDefaultOverlay",
        zxOverlay.FlashButtonClicked += (sender,e) =>
          zxingControl.IsTorchOn = !zxingControl.IsTorchOn;
        zxingControl.IsScanning = true;
        zxingControl.IsAnalyzing = true;
Sign In or Register to comment.