iOS Notification registration stopped working

GerryHGerryH USMember ✭✭✭
edited June 18 in Xamarin.iOS

Last week: notifications working okay (for many weeks).
Monday: (no code changes) notification registration fails with error:

I get the same thing with: https://github.com/xamarin/ios-samples/tree/master/Notifications

What does it mean? Where is the real problem?

[I have been googling and trying different things for hours, can only make it worse.]

Best Answer

Answers

  • GerryHGerryH USMember ✭✭✭

    In the device log I found
    Invalid token for remote notifications

    Don't know where or what token that is.

  • GerryHGerryH USMember ✭✭✭

    Thanks I will check it out.

  • GerryHGerryH USMember ✭✭✭

    I got my app to run without errors, but when I send a test notification it is not received.

    Wondering about this code:

            // step 2 in registering
            public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
            {
                var ds = DataSource.Instance;
                Hub = new SBNotificationHub(ds.AzureHub, ds.AzureName);
                Hub.UnregisterAllAsync(deviceToken, (error) =>
                {
                    if (error != null)
                    {
                        // error unregistering, whatever
                        Console.WriteLine("Unregister for notifications failed for whatever reason, ignorning");
                    }
    
                    Hub.RegisterNativeAsync(deviceToken, UserTags(), (registerError) =>
                    {
                       if (registerError != null)
                          Console.WriteLine("azure registration failed");
                       else
                          Messenger.RegisteriOS(deviceToken.ToString());
                    });
                });
            }
    

    Is it still necessary to call Hub.UnregisterAllAsyn? Apple docs seem to imply you should not unregister. But I don't know if the code unregisters with Azure or with Apple.

Sign In or Register to comment.