Azure-docs: Documentation does not match modern library (RegisterNativeAsync, UnregisterAllAsync), change of paramaters

Created on 8 Oct 2019  Â·  9Comments  Â·  Source: MicrosoftDocs/azure-docs

As of version 2.0.4 (first update in a while), this documentation no longer matches code.

Documentation notes you should do Hub.RegisterNativeAsync(deviceToken, tags, (errorCallback)). Now, it only supports deviceToken and tags, no longer the third parameter.

I am assuming because the code was updated to handle await, but the examples do not show this.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 assigned-to-author doc-bug notification-hubsvc triaged

Most helpful comment

You've closed this but the docs STILL haven't changed...
https://docs.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-ios-push-notification-apns-get-started#connect-your-app-to-the-notification-hub

`public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
Hub = new SBNotificationHub(Constants.ListenConnectionString, Constants.NotificationHubName);

Hub.UnregisterAll (deviceToken, (error) => {
    if (error != null)
    {
        System.Diagnostics.Debug.WriteLine("Error calling Unregister: {0}", error.ToString());
        return;
    }

    NSSet tags = null; // create tags if you want
    Hub.RegisterNativeAsync(deviceToken, tags, (errorCallback) => {
        if (errorCallback != null)
            System.Diagnostics.Debug.WriteLine("RegisterNativeAsync error: " + errorCallback.ToString());
    });
});

}`

All 9 comments

Thanks for the feedback! We are currently investigating and will update you shortly.

Just use Hub.RegisterNative to use the third parameter (also UnregisterAll method is affected by this change!)

@sethmanheim can you please verify this?

Upon further review we feel your feedback would be best received by the doc author to determine if an update to the current doc is necessary if they align with the feedback.

@simonemarra this is actually what I did locally, just worry that 1) I am now missing any async call, but 2) the documentation as is wouldn't work right from this change.

@jmlumpkin Thank you for reporting this. I am investigating and will get back with a doc update ASAP.

@jmlumpkin Again, thank you. Some of the Notification Hubs tutorials are out of date due to Apple and Azure portal changes; we are working our way through them to make sure they are current.

please-close

You've closed this but the docs STILL haven't changed...
https://docs.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-ios-push-notification-apns-get-started#connect-your-app-to-the-notification-hub

`public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
Hub = new SBNotificationHub(Constants.ListenConnectionString, Constants.NotificationHubName);

Hub.UnregisterAll (deviceToken, (error) => {
    if (error != null)
    {
        System.Diagnostics.Debug.WriteLine("Error calling Unregister: {0}", error.ToString());
        return;
    }

    NSSet tags = null; // create tags if you want
    Hub.RegisterNativeAsync(deviceToken, tags, (errorCallback) => {
        if (errorCallback != null)
            System.Diagnostics.Debug.WriteLine("RegisterNativeAsync error: " + errorCallback.ToString());
    });
});

}`

Was this page helpful?
0 / 5 - 0 ratings

Related issues

monteledwards picture monteledwards  Â·  3Comments

jamesgallagher-ie picture jamesgallagher-ie  Â·  3Comments

behnam89 picture behnam89  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

mrdfuse picture mrdfuse  Â·  3Comments