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));
}
}
オリジナルのコードは、事前にありがとうございます。