Redth / ZXing.Net.Maui

Barcode Scanning for MAUI?
MIT License
474 stars 150 forks source link

CameraBarCodeReaderView can scan barcode but has no camera preview in iOS. It's just black screen. #61

Open lancecontreras opened 2 years ago

lancecontreras commented 2 years ago

I'm using iPhone 14 Pro Max, iOS 16

ZXing.Net.Maui version 0.2.0-preview2

The camera preview is not showing in iOS, I can scan barcode and the value shows on my screen when barcode is detected but the camera preview is just black.

julianadormon commented 2 years ago

I can confirm the same issue running on iPhone 11, IOS 16. The camera view does not appear but the scan works nonetheless. I am running version 0.1.0 preview 7 as I wanted to target iOS 15.5 and up.

ckrutsinger commented 1 year ago

After being prompted for permission to use Camera, I get a white screen for the CameraBarcodeReaderView when running in iOS 16.3.1 on iPhone XR. ZXing.Net.MAUI 0.3.0-preview1 Unable to scan or see camera preview. Works fine on Android, but not iOS.

ckrutsinger commented 1 year ago

I did fix this. The reader view only shows when there is a specific height and width set. However, I got it to show inside a grid because the grid sets the height and width.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI.Controls"
             x:Class="FleetHDMobile.Views.ScanPage"
             >

    <Grid>
        <zxing:CameraBarcodeReaderView x:Name="barcodeReader"
                                        BarcodesDetected="CameraBarcodeReaderView_BarcodesDetected" 
                                        />
    </Grid>

</ContentPage>