Я использовал Toasts.Forms.Plugin от EgorBo в проекте, и он отлично работал. Я добавил его в новый проект, но я не могу найти ToastNotification или IToastNotification и тост не отображается.Xamarin Forms: Toasts.Forms.Plugin error
Моя Xamarin.Forms версия 2.3.2.127 и ваш компонент 1.0.1
Я пытался добавить этот код в IOS AppDelegate.cs
DependencyService.Register<Plugin.Toasts.CrossToasts>();
Plugin.Toasts.ToastsImplementation.Init();
но, очевидно, это Безразлично» т работы. Я попытался изменить свой статический метод, но IToasts не работает.
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));
}
}
Оригинальный код в AppDelegate.cs
DependencyService.Register<ToastNotificatorImplementation>();
ToastNotificatorImplementation.Init();
Оригинальный код в моем классе
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));
}
}
Спасибо заранее.