亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

C# Xamarin iOS RegisteredForRemoteNotifications

C# Xamarin iOS RegisteredForRemoteNotifications

C#
鳳凰求蠱 2021-10-24 19:29:45
你好 !我正在嘗試使用Azure Notification Hub在我的 xamarin iOS 應用程序上添加通知。按照本教程(https://docs.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-ios-push-notification-apns-get-started)之后,我遇到了一個問題在我的 appdelegate.cs 文件中:RegisteredForRemoteNotifications方法從未被觸發,因此我的應用程序無法在我的集線器上注冊。通知的所有權限都已完成,設置也是如此,我做了很多研究,但沒有一個解決方案適用于我的情況。我已經嘗試過Xamarin.iOS RegisteredForRemoteNotifications not called在我的 FinishedLaunching 方法中,我有:if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)){        UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound, (granted, error) =>         {            if (granted)            {                    InvokeOnMainThread(UIApplication.SharedApplication.RegisterForRemoteNotifications);            }        });}else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)){        var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet());        UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);        UIApplication.SharedApplication.RegisterForRemoteNotifications();}else{        UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;        UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);}我的RegisteredForRemoteNotifications方法是:public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)    {            Hub = new SBNotificationHub(Constants.ListenConnectionString, Constants.NotificationHubPath);            Hub.UnregisterAllAsync(deviceToken, (error) => {                if (error != null)                {                        Console.WriteLine("Error calling Unregister: {0}", error.ToString());                        return;                }
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 213 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號