0

I used Toasts.Forms.Plugin by EgorBo in a project and it was working fine. I added it in a new project but I can't find ToastNotification or IToastNotification and the toast doesn't appear.

My Xamarin.Forms version is 2.3.2.127 and your component is 1.0.1

I tried to add this code in the iOS AppDelegate.cs

DependencyService.Register<Plugin.Toasts.CrossToasts>();
Plugin.Toasts.ToastsImplementation.Init();

but obviously it doesn't work. I tried to change my static method but IToasts it doesn't work.

public static async Task ShowToast(ToastNotificationType type, 
                                   string title, string description) {
    var notificator = DependencyService.Get<Plugin.Toasts.Abstractions.IToasts>();
    if (notificator != null) {
        bool tapped = await notificator.Notify(type, title, description, 
                                               TimeSpan.FromSeconds(2));
    }
}

Original code in AppDelegate.cs

DependencyService.Register<ToastNotificatorImplementation>();
ToastNotificatorImplementation.Init();

Original code in my class

public static async void ShowToast(ToastNotificationType type, string title, 
                                   string description) {
    var notificator = DependencyService.Get<IToastNotificator>();
    if (notificator != null) {
        bool tapped = await notificator.Notify(type, title, description, 
                                               TimeSpan.FromSeconds(2));
    }
}

Thank you in advance.

Enrico
  • 3,592
  • 6
  • 45
  • 102

1 Answers1

0

Version 3 and higher technically only supports .NET standard 1.1 and higher. The recommended approach is to stay on 2.0.4 if you havent upgraded to .NET standard.

Enrico
  • 3,592
  • 6
  • 45
  • 102