C# ZXing未在iOS设备上检测到二维码

C# ZXing未在iOS设备上检测到二维码,c#,xamarin,xamarin.forms,xamarin.android,xamarin.ios,C#,Xamarin,Xamarin.forms,Xamarin.android,Xamarin.ios,我正在创建一个程序来读取Xamarin中的二维码。我遵循了这个链接中的步骤 它在Andriod上工作得很好,但在iOS上却不行。 我尝试了不同版本的 ZXing.Net.Mobile ZXing.Net.Mobile.Forms 测试版也没有给我结果 这是我的密码 var scanPageOptions = new MobileBarcodeScanningOptions() { AutoRotate = false, TryI

我正在创建一个程序来读取Xamarin中的二维码。我遵循了这个链接中的步骤

它在Andriod上工作得很好,但在iOS上却不行。 我尝试了不同版本的

ZXing.Net.Mobile
ZXing.Net.Mobile.Forms
测试版也没有给我结果

这是我的密码

var scanPageOptions = new MobileBarcodeScanningOptions()
        {
            AutoRotate = false,
            TryInverted = true,
            TryHarder = true,
            PossibleFormats = new List<ZXing.BarcodeFormat>() { ZXing.BarcodeFormat.QR_CODE }
        };
        var scanPage = new ZXingScannerPage(scanPageOptions);
            scanPage.IsAnalyzing = true;
            scanPage.IsScanning = true;
            scanPage.IsTorchOn = true;

            scanPage.OnScanResult += (result) =>
            {
                scanPage.IsScanning = false;
                if (result != null)
                {
                    Device.BeginInvokeOnMainThread(async () =>
                    {
                        await Navigation.PopAsync();
                        await DisplayAlert("Scanned Barcode", result.Text, "OK");
                    });
                }
                else
                {
                    Navigation.PopAsync();
                    DisplayAlert("Scanned Barcode", "No Barcode Found", "OK");
                }
                
            };

            await Navigation.PushAsync(scanPage);
var scanPageOptions=new MobileBarcodeScanningOptions()
{
自动旋转=错误,
TryInverted=true,
TryHarder=true,
可能格式=新列表(){ZXing.BarcodeFormat.QR_CODE}
};
var scanPage=新ZXING SCANNERPAGE(扫描页面选项);
scanPage.IsAnalyzing=true;
scanPage.IsScanning=true;
scanPage.IsTorchOn=true;
scanPage.OnScanResult+=(结果)=>
{
scanPage.IsScanning=false;
如果(结果!=null)
{
Device.beginInvokeMainThread(异步()=>
{
等待导航。PopAsync();
等待显示警报(“扫描的条形码”,结果文本,“确定”);
});
}
其他的
{
Navigation.popsync();
显示警报(“扫描的条形码”、“未找到条形码”、“确定”);
}
};
等待导航。PushAsync(扫描页面);
我也试过另一种方法,那就是

MobileBarcodeScanner scanner = new MobileBarcodeScanner();
        scanner.TopText = "Hold the camera up to the barcode\nAbout 6 inches away";
        scanner.BottomText = "Wait for the barcode to automatically scan!";
        scanner.AutoFocus();
        //This will start scanning

        var scanPageOptions = new MobileBarcodeScanningOptions()
        {
            AutoRotate = false,
            TryInverted = true,
            TryHarder = true,
            PossibleFormats = new List<ZXing.BarcodeFormat>() { ZXing.BarcodeFormat.QR_CODE }
        };

        ZXing.Result result = await scanner.Scan(scanPageOptions);
        var msg = "No Barcode!";
        if (result != null)
        {
            msg = "Barcode: " + result.Text + " (" + result.BarcodeFormat + ")";
        }

        DisplayAlert("", msg, "Ok");
MobileBarcodeScanner scanner=新的MobileBarcodeScanner();
scanner.TopText=“将相机保持在条形码附近\n 6英寸处”;
scanner.BottomText=“等待条形码自动扫描!”;
scanner.AutoFocus();
//这将开始扫描
var scanPageOptions=new MobileBarcodeScanningOptions()
{
自动旋转=错误,
TryInverted=true,
TryHarder=true,
可能格式=新列表(){ZXing.BarcodeFormat.QR_CODE}
};
ZXing.Result结果=等待扫描程序.Scan(扫描页面选项);
var msg=“无条形码!”;
如果(结果!=null)
{
msg=“条形码:“+result.Text+”(“+result.BarcodeFormat+”);
}
显示警报(“,消息,“Ok”);
在iOS上没有给出任何结果。
iOS设备检测QR码时缺少的功能。

尝试在iOS中更新内核。像这样的问题通常是由于旧版本内核中的bug造成的。两台机器的核心版本是否相同?@jdweng感谢您的评论。我正在两台设备上测试它1。最新iOS版本的iPhone XR。2.iPhone11Pro-MAX也有最新版本。我说的是内核!!!见: