[英]Xamarin iOS Local Notifications not working
我已經在iOS本地通知中完成了Xamarin演練:
我就是無法正常工作。 它構建良好,但是AppDelegate
上的ReceivedLocalNotification
方法從不觸發。 我究竟做錯了什么?
如果您使用的是iOS 8,則還需要注冊您的應用以接收通知,如下所述:
將以下代碼添加到AppDelegate
類的FinishedLaunching
方法中:
if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) {
UIUserNotificationType notificationTypes = UIUserNotificationType.Alert |
UIUserNotificationType.Badge |
UIUserNotificationType.Sound;
var userNoticationSettings = UIUserNotificationSettings.GetSettingsForTypes(notificationTypes, new NSSet(new string[] {}));
UIApplication.SharedApplication.RegisterUserNotificationSettings (userNoticationSettings);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.