azure-notificationhubs-ios icon indicating copy to clipboard operation
azure-notificationhubs-ios copied to clipboard

[BUG] MSInstallationLifecycleDelegate and MSInstallationEnrichmentDelegate are not work.

Open muak opened this issue 2 years ago • 0 comments

Describe the bug MSInstallationLifecycleDelegate and MSInstallationEnrichmentDelegate method are not called. RegisteredForRemoteNotifications is called correctly.

Exception or Stack Trace

To Reproduce

Code Snippet

    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate, IUNUserNotificationCenterDelegate
    {        
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {            
            global::Xamarin.Forms.Forms.Init();
            
            UNUserNotificationCenter.Current.Delegate = this;            
            
            LoadApplication(new App());

            
            MSNotificationHub.SetDelegate(new AzureNotificationHubListener());
            MSNotificationHub.SetLifecycleDelegate(new AzureInstallationLifecycleListener());
            MSNotificationHub.SetEnrichmentDelegate(new AzureInstallationEnrichmentListener());
            MSNotificationHub.Start(Constants.NotificationHubUrl, Constants.NotificationHubName);
            
            return base.FinishedLaunching(app, options);
        }

        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
             // This method is called correctlly.
        }

        public override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
        {
            ;
        }

    public class AzureNotificationHubListener : MSNotificationHubDelegate
    {
        public override void DidReceivePushNotification(MSNotificationHub notificationHub, MSNotificationHubMessage message)
        {
            // This method is called correctlly.
        }
    }

    public class AzureInstallationLifecycleListener : MSInstallationLifecycleDelegate
    {
        public override void DidFailToSaveInstallation(MSNotificationHub notificationHub, MSInstallation installation, NSError error)
        {
            ;
        }

        public override void DidSaveInstallation(MSNotificationHub notificationHub, MSInstallation installation)
        {
            // This method is not called.
        }
    }

    public class AzureInstallationEnrichmentListener : MSInstallationEnrichmentDelegate
    {
        public override void WillEnrichInstallation(MSNotificationHub notificationHub, MSInstallation installation)
        {
            // This method is not called.
        }
    }

Expected behavior

DidSaveInstallation and WillEnrichInstallation are called.

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

  • OS: [iOS 14.7.1]
  • IDE : [Xcode 13.2.1][VS for Mac 8.10.19]
  • Version of the Library used [3.1.1]
  • Xamarin.Forms version 5.0.0.2337

Additional context Add any other context about the problem here.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [ ] Bug Description Added
  • [ ] Repro Steps Added
  • [ ] Setup information Added

muak avatar Feb 28 '22 02:02 muak