프로젝트에서 EgorBo의 Toasts.Forms.Plugin 을 사용 했는데 제대로 작동했습니다. 새 프로젝트에 추가했지만 ToastNotification 또는 IToastNotification을 찾을 수없고 알림 이 표시되지 않습니다.
내 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));
}
}
미리 감사드립니다.
버전 3 이상은 기술적으로 .NET 표준 1.1 이상 만 지원합니다. 권장되는 접근 방식은 .NET 표준으로 업그레이드하지 않은 경우 2.0.4를 유지하는 것입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다