2016-11-09 7 views
0

Я использовал 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)); 
    } 
} 

Спасибо заранее.

ответ

0

Версия 3 и выше технически поддерживает только стандарт .NET 1.1 и выше. Рекомендуемый подход заключается в том, чтобы оставаться на 2.0.4, если вы не обновили стандарт .NET.