'Issue : Xamarin iOS - AVFoundation Barcode Scan Issue with iOS 15 Beta 3 onwards

We have a XamarinForms Mobile App for scanning and listing the Barcodes. We have implemented scanning using AV Foundation. The App has a UI in such a way that its has 1/4 screen UI for camera and a UI list below camera. Issue : After iOS 15 Beta update the scanning is not working properly and its not scanning the barcode on which camera focusing , instead its scanning another barcode which is above the intended barcode.

Please assist.

Thanks


[Export("captureOutput:didOutputMetadataObjects:fromConnection:")]
        public async void DidOutputMetadataObjects(AVCaptureMetadataOutput captureOutput, AVMetadataObject[] metadataObjects, AVCaptureConnection connection)
        {
            if (shouldSendReadBarcodeToDelegate == true)
            {
                shouldSendReadBarcodeToDelegate = false;

                prevObj.ScannedText = String.Empty;
                foreach (var m in metadataObjects)
                {

                    var avmmrcobj_readable = (AVMetadataMachineReadableCodeObject)m;
                    if (avmmrcobj_readable.StringValue != prevObj.ScannedText)
                    {
                        prevObj.ScannedText = avmmrcobj_readable.StringValue;
                    }
                }
                await Task.Run(async () =>
                {
                    shouldSendReadBarcodeToDelegate = true;
                });
            }
        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source