2016-11-09 15 views
0

I Toasts.Forms.Plugin von EgorBo in einem Projekt verwendet und es funktioniert gut. Ich habe es in einem neuen Projekt, aber ich kann nicht ToastNotification oder IToastNotification und der Toast nicht angezeigt finden.Xamarin Forms: Toasts.Forms.Plugin Fehler

Meine Xamarin.Forms Version 2.3.2.127 und Ihre Komponente 1.0.1

Ich habe versucht, diesen Code in die iOS AppDelegate.cs

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

aber offensichtlich ist es doesn‘hinzufügen t Arbeit. Ich versuchte, meine statische Methode aber IToasts zu ändern es funktioniert nicht.

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)); 
    } 
} 

Originalcode in AppDelegate.cs

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

Originalcode in meiner Klasse

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)); 
    } 
} 

Vielen Dank im Voraus.

Antwort

0

Version 3 und höher technisch unterstützt nur .NET-Standard 1.1 und höher. Der empfohlene Ansatz ist auf 2.0.4 zu bleiben, wenn Sie .NET-Standard aufgerüstet haben.