# Xamarin.Forms iOS Application Crashes With ActivityMediator In AppDelegate

**URL:** <https://community.auth0.com/t/xamarin-forms-ios-application-crashes-with-activitymediator-in-appdelegate/73787>\
**Category:** Get Help\
**Tags:** xamarin-forms, xamarin\
**Created:** [November 25, 2021, 9:56pm UTC](https://community.auth0.com/t/xamarin-forms-ios-application-crashes-with-activitymediator-in-appdelegate/73787 "2021-11-25T21:56:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ldegianni](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ldegianni/32/32695_2.png) [@ldegianni](https://community.auth0.com/u/ldegianni)\
**Post date:** [November 25, 2021, 9:56pm UTC](https://community.auth0.com/t/xamarin-forms-ios-application-crashes-with-activitymediator-in-appdelegate/73787/1 "2021-11-25T21:56:08Z")

</div>

Here is my AppDelegate.cs file:

```auto
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 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.Pickers.iOS;
using Auth0.OidcClient;
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 class AppDelegate : Xamarin.Forms.Platform.iOS.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)
        {
            Xamarin.Forms.Forms.SetFlags("UseLegacyRenderers");
            Xamarin.Forms.Forms.Init();
            IQKeyboardManager.SharedManager.Enable = true;
            Sharpnado.Shades.iOS.iOSShadowsRenderer.Initialize();
            SfEffectsViewRenderer.Init();
            SfCardLayoutRenderer.Init();
            SfCarouselRenderer.Init();
            SfKanbanRenderer.Init();
            Syncfusion.SfGauge.XForms.iOS.SfGaugeRenderer.Init();
            SfListViewRenderer.Init();
            new SfRangeSliderRenderer();
            Syncfusion.XForms.iOS.ComboBox.SfComboBoxRenderer.Init();
            SfPopupLayoutRenderer.Init();
            Syncfusion.SfChart.XForms.iOS.Renderers.SfChartRenderer.Init();
            SfEffectsViewRenderer.Init();
            Syncfusion.XForms.iOS.ProgressBar.SfLinearProgressBarRenderer.Init();
            Syncfusion.XForms.iOS.Border.SfBorderRenderer.Init();
            new SfRotatorRenderer();
            CardsViewRenderer.Preserve();
            SfTextInputLayoutRenderer.Init();
            LoadApplication(new App());
            Syncfusion.XForms.iOS.Border.SfBorderRenderer.Init();
            SfButtonRenderer.Init();
            SfSegmentedControlRenderer.Init();
            new SfNumericTextBoxRenderer();
            SfChipRenderer.Init();
            SfChipGroupRenderer.Init();
            SfCheckBoxRenderer.Init();
            new SfBusyIndicatorRenderer();
            SfTimePickerRenderer.Init();
            SfSwitchRenderer.Init();
            Rg.Plugins.Popup.Popup.Init();
            new SfAutoCompleteRenderer();
            SfPullToRefreshRenderer.Init();
            SfCalendarRenderer.Init();
            UIApplication.SharedApplication.StatusBarHidden = true;
            return base.FinishedLaunching(app, options);
        }

        public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
        {
            base.OpenUrl(application, url, sourceApplication, annotation);
            ActivityMediator.Instance.Send(url.AbsoluteString);

            return true;
        }
    }
}

```

I am finding that the application runs as expected in Debug mode, but crashes on open in Release. If I disable the linker in the Release configuration then the crash goes away. If I comment out the line:

`ActivityMediator.Instance.Send(url.AbsoluteString);`

and then rebuild the app with linking enabled the crash goes away.

Has anyone encountered this issue? Does anyone have recommendations for troubleshooting?

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 26, 2021, 4:35pm UTC](https://community.auth0.com/t/xamarin-forms-ios-application-crashes-with-activitymediator-in-appdelegate/73787/2 "2021-11-26T16:35:36Z")

</div>

Hey there!

The most effective way to handle that would be to raise a GitHub issue on that, then share it here so we can ping repo maintainers and work on that directly with them.

---

<div class="post-metadata">

**Author:** ![ldegianni](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ldegianni/32/32695_2.png) [@ldegianni](https://community.auth0.com/u/ldegianni)\
**Post date:** [December 2, 2021, 12:29am UTC](https://community.auth0.com/t/xamarin-forms-ios-application-crashes-with-activitymediator-in-appdelegate/73787/3 "2021-12-02T00:29:28Z")

</div>

I was able to find a solution. From my understanding the dynamic registrar was being removed causing this exception: `ObjCRuntime.RuntimeException: Can't register the class Plugin.BLE.BleCentralManagerDelegate when the dynamic registrar has been linked away`. I am not sure why this was happening, but adding the following flag in **Additional mtouch arguments** fixed the crash: `--optimize=-remove-dynamic-registrar`

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 6, 2021, 8:15pm UTC](https://community.auth0.com/t/xamarin-forms-ios-application-crashes-with-activitymediator-in-appdelegate/73787/4 "2021-12-06T20:15:24Z")

</div>

Woooohoo! Thanks for sharing that with the rest of community!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 7, 2021, 2:40pm UTC](https://community.auth0.com/t/xamarin-forms-ios-application-crashes-with-activitymediator-in-appdelegate/73787/5 "2021-12-07T14:40:25Z")

</div>


