我們?cè)谑褂?Xamarin.Forms 的 ZXing Barcodescanner 時(shí)遇到問題。掃描儀在 Android 上完美運(yùn)行,但在 IOS 上我看不到相機(jī)圖像(預(yù)覽)。如果我將條碼放在相機(jī)前,掃描儀確實(shí)可以掃描 IOS 上的條碼,但相機(jī)預(yù)覽只是白色背景。我嘗試使用這些選項(xiàng),但沒有運(yùn)氣。我們使用 Prism.Forms 進(jìn)行 MVVM。正如我提到的,我的代碼在 Android 上運(yùn)行良好。以下是一些細(xì)節(jié):兩個(gè)平臺(tái)上的權(quán)限均已正確設(shè)置。NuGets ZXing.Net.Mobile 和 ZXing.Net.Mobile.Forms 也添加到所有三個(gè)項(xiàng)目(Android、IOS 和便攜式)我們正在使用 .NET Standard 2.0Xamarin.Forms 版本為 3.4.0ScannerView.xaml<forms:ZXingScannerPage xmlns="http://xamarin.com/schemas/2014/forms"? ? ? ? ? ? ? ? ? ? xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"? ? ? ? ? ? ? ? ? ? xmlns:forms="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms"? ? ? ? ? ? ? ? ? ? x:Class="App.Portable.View.ScannerView"><ContentPage.Content>? ? <Grid>? ? ? ? <Grid.RowDefinitions>? ? ? ? ? ? <RowDefinition Height="*"/>? ? ? ? </Grid.RowDefinitions>? ? ? ? <forms:ZXingScannerView x:Name="scanner" Grid.Column="0" Grid.Row="0" HorizontalOptions="EndAndExpand" VerticalOptions="FillAndExpand"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IsScanning="{Binding IsScanning}"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IsAnalyzing="{Binding IsAnalyzing}"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Result="{Binding Result, Mode=TwoWay}"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ScanResultCommand="{Binding CmdScanResult}"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Options="{Binding ScannerOptions}"? ? ? ? />? ? ? ? <forms:ZXingDefaultOverlay Grid.Column="0" Grid.Row="0"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?TopText="Some title"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ShowFlashButton="False"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?BottomText="Some bottom text"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Opacity="0.9"/>? ? </Grid></ContentPage.Content>有人在我的代碼中發(fā)現(xiàn)問題,或者對(duì)如何做得更好或至少讓它工作有一些建議嗎?
ZXing Xamarin 在 IOS 上形成白色背景
慕標(biāo)5832272
2023-06-25 13:44:07