0

我在页面上的 AppShell 中使用了 ZXing Nuget 包。它在 AppShell 之外运行良好,但是当我将它添加到 appshell 时。访问页面时收到此错误消息。

xamarin 对象引用未设置为 Zxing.Net.Mobile.Forms.iOS.ZXingScannerView Renderer.LayoutSubviews 处的对象实例

这只发生在 iOS 项目中。

这是扫描仪视图的 XAML 部分。

 <StackLayout FlexLayout.Grow="1"
                                 HorizontalOptions="FillAndExpand"
                                 VerticalOptions="FillAndExpand">
                                 <RelativeLayout x:Name="ZXingScannerViewRelativeLayout"
                                                 HorizontalOptions="FillAndExpand"
                                                 VerticalOptions="FillAndExpand"
                                                 FlexLayout.AlignSelf="Center">
                                          <zxing:ZXingScannerView x:Name="ZXingScannerView1" 
                                                    IsScanning="{Binding IsScanning}" 
                                                    ScanResultCommand="{Binding ScanResultCommand}"
                                                    HorizontalOptions="FillAndExpand"
                                                    VerticalOptions="FillAndExpand" 
                                                    AutomationId = "zxingScannerView"
                                                    IsAnalyzing="{Binding IsAnalyzing}"
                                                    Result="{Binding ScannedResult, Mode=TwoWay}"
                                                    IsTorchOn="{Binding IsTorchOn}" 
                                                    IsVisible="{Binding ScannerViewIsVisible}"
                                                    RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,Property=Width}"
                                                    RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,Property=Height}">
                                          </zxing:ZXingScannerView>
                                 </RelativeLayout>

                           

                       </StackLayout>

有任何想法吗?

4

0 回答 0