【问题标题】:Xamarin.Forms iOS Project Crashes On Startup With Linking Enabled And Auth0.OidcClient And SfListViewRenderer EnabledXamarin.Forms iOS 项目在启用链接和 Auth0.OidcClient 和 SfListViewRenderer 的情况下启动时崩溃
【发布时间】:2022-01-06 17:29:39
【问题描述】:

我一直在尝试查找我的 AppDelegate.cs 中似乎由 Auth0.OidcClient.ActivityMediatorSyncfusion.ListView 引起的崩溃.XForms.iOS.SfListViewRenderer 。仅在启用链接的发布模式下启动时才会发生崩溃(仅使用 Link Framework SDK 或 Link All 会发生崩溃)。我还发现,如果我删除以下行之一:

SfListViewRenderer.Init(); //Problem line 1.

或:

ActivityMediator.Instance.Send(url.AbsoluteString); //Problem line 2.

然后崩溃消失了。只有启用了这两行并启用了链接,才会发生崩溃。这是我的 AppDelegate.cs:

 using Auth0.OidcClient;
 using Foundation;
 using PanCardView.iOS;
 using Syncfusion.ListView.XForms.iOS;
 using Syncfusion.SfAutoComplete.XForms.iOS;
 using Syncfusion.SfBusyIndicator.XForms.iOS;
 using Syncfusion.SfCalendar.XForms.iOS;
 using Syncfusion.SfCarousel.XForms.iOS;
 using Syncfusion.SfKanban.XForms.iOS;
 using Syncfusion.SfNumericTextBox.XForms.iOS;
 using Syncfusion.SfPullToRefresh.XForms.iOS;
 using Syncfusion.SfRangeSlider.XForms.iOS;
 using Syncfusion.SfRotator.XForms.iOS;
 using Rg.Plugins.Popup;
 using Syncfusion.XForms.iOS.Buttons;
 using Syncfusion.XForms.iOS.Cards;
 using Syncfusion.XForms.iOS.EffectsView;
 using Syncfusion.XForms.iOS.PopupLayout;
 using Syncfusion.XForms.iOS.TextInputLayout;
 using Syncfusion.XForms.iOS.ComboBox;
 using Syncfusion.XForms.iOS.ProgressBar;
 using Syncfusion.XForms.Pickers.iOS;
 using Xamarin.Forms.Platform.iOS;
 using Syncfusion.XForms.iOS.Border;
 using Syncfusion.SfGauge.XForms.iOS;
 using Syncfusion.SfChart.XForms.iOS.Renderers;
 using Xamarin.Forms;
 using Sharpnado.Shades.iOS;
 using UIKit;
 using Xamarin;
    
 namespace VulcanApp.iOS
 {
     // The UIApplicationDelegate for the application. This class is responsible for launching the 
     // User Interface of the application, as well as listening (and optionally responding) to 
     // application events from iOS.
     [Register("AppDelegate")]
     public partial class AppDelegate : FormsApplicationDelegate
     {
         //
         // This method is invoked when the application has loaded and is ready to run. In this 
         // method you should instantiate the window, load the UI into it and then make the window
         // visible.
         //
         // You have 17 seconds to return from this method, or iOS will terminate your application.
         //
         public override bool FinishedLaunching(UIApplication app, NSDictionary options)
         {
             Forms.SetFlags("UseLegacyRenderers");
             Forms.Init();
    
             IQKeyboardManager.SharedManager.Enable = true;
    
             iOSShadowsRenderer.Initialize();
    
             new SfRangeSliderRenderer();
             new SfRotatorRenderer();
             new SfNumericTextBoxRenderer();
             new SfBusyIndicatorRenderer();
             new SfAutoCompleteRenderer();
    
             CardsViewRenderer.Preserve();
    
             Popup.Init();
    
             SfListViewRenderer.Init(); //Problem line 1.
             SfEffectsViewRenderer.Init();
             SfCardLayoutRenderer.Init();
             SfCarouselRenderer.Init();
             SfKanbanRenderer.Init();
             SfGaugeRenderer.Init();
             SfComboBoxRenderer.Init();
             SfPopupLayoutRenderer.Init();
             SfChartRenderer.Init();
             SfLinearProgressBarRenderer.Init();
             SfTextInputLayoutRenderer.Init();
             SfBorderRenderer.Init();
             SfButtonRenderer.Init();
             SfSegmentedControlRenderer.Init();
             SfChipRenderer.Init();
             SfChipGroupRenderer.Init();
             SfCheckBoxRenderer.Init();
             SfTimePickerRenderer.Init();
             SfSwitchRenderer.Init();
             SfPullToRefreshRenderer.Init();
             SfCalendarRenderer.Init();
    
             UIApplication.SharedApplication.StatusBarHidden = true;
    
             LoadApplication(new App());
    
             return base.FinishedLaunching(app, options);
         }
    
         //This method is required for using the OidcClient on iOS.
         public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
         {
             ActivityMediator.Instance.Send(url.AbsoluteString); //Problem line 2.
    
             return true;
         }
     }
 }

我已尝试删除和恢复软件包。清空 bin/ 和 obj/ 文件夹并重新排列各种 Syncfusion 元素的初始化顺序。我在 iOS 14.8 iPad 和 iOS 15.1 iPad 上遇到了崩溃。

有人知道这里会发生什么吗?有人对故障排除有任何建议吗?

【问题讨论】:

标签: c# ios xamarin xamarin.forms


【解决方案1】:

我找到了解决方案。据我了解,动态注册商已被删除,导致此异常:ObjCRuntime.RuntimeException: Can't register the class Plugin.BLE.BleCentralManagerDelegate when the dynamic registrar has been linked away。我不确定为什么会发生这种情况,但在 Additional mtouch arguments 中添加以下标志修复了崩溃:--optimize=-remove-dynamic-registrar

【讨论】:

    猜你喜欢
    • 2017-12-18
    • 2018-03-07
    • 2022-08-10
    • 1970-01-01
    • 2015-10-26
    • 1970-01-01
    • 1970-01-01
    • 2020-01-09
    • 1970-01-01
    相关资源
    最近更新 更多