Hub.UnregisterAll callback is never called

odinhaus 1 Reputation point
2020-08-04T16:13:37.717+00:00

I am trying to integrate Azure Push into a Xamarin.Forms iOS app.

I follow the sample code as it is written: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/azure-services/azure-notification-hub#configure-ios-for-notifications.

I make sure my bundle ID, certs, etc. are all matching.

The problem is, in the same code, registration depends on the callback to UnregisterAll actually being called by the underlying framework.

this.Hub.UnregisterAll(deviceToken, (error) =>  
{  
    // the callback is never called...  
    if (error != null)  
    {  
        System.Diagnostics.Debug.WriteLine("Error calling unregister: {0}", error.ToString());  
        return;  
    }  
    NSSet tags = null;  
    this.Hub.RegisterNative(deviceToken, tags, (e) =>  
    {  
        if (e != null)  
        {  
            System.Diagnostics.Debug.WriteLine("Error calling unregister: {0}", e.ToString());  
        }  
    });  
});  

In my case, the callback is never called. No errors are produced, and even when I turn on breaks for all errors, there are none. Nothing is logged to the console either. It just doesn't work and silently continues.

I have also tried using the Async variants on these methods, with await, and in that case, the Async method will hang forever and never complete.

I and debugging on an actual iPhone, because I can't get the simulators to ever work, and I am using Hot Reload to deploy the app and hook the debugger. Not sure if this matters or not?

The iPhone is running 13.5.1.

Hoping someone can figure out what I need to do here, because this issue currently has our project completely dead in the water.

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
265 questions
{count} votes