2016-11-09 8 views
0

私はプロジェクトでEgorBoによってToasts.Forms.Pluginを使用しましたが、うまくいきました。新しいプロジェクトに追加しましたが、見つからないToastNotificationまたはIToastNotificationトーストは表示されません。Xamarinフォーム:Toasts.Forms.Pluginエラー

マイXamarin.Formsのバージョンは2.3.2.127であり、あなたのコンポーネントが、私はiOSの中でAppDelegate.cs

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

をこのコードを追加しようとしたが、明らかにそれはdoesnの1.0.1

です仕事。静的メソッドを変更しようとしましたが、IToastsは機能しません。私のクラス

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

でAppDelegate.cs

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

オリジナルコードで

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

オリジナルのコードは、事前にありがとうございます。

答えて

0

バージョン3以上は、技術的には.NET標準1.1以上しかサポートしていません。推奨される方法は、.NET標準にアップグレードしない場合は2.0.4にとどまることです。

関連する問題