Azure Notification Hub Registrations fail with some tag formats

I am using Xamarin on iOS versus Azure Notification Hub. Things worked fine for a while. But I recently added a new TAG to the tag collection with which I register my devices.

Here is the shortened code that WORK:

NSSet tags = new NSSet("Email-some@some.com");
if (tags != null) {
    Hub.RegisterNativeAsync(deviceToken, tags,(errorCallback) => {
        if (errorCallback != null) {
            new UIAlertView("RegisterNativeAsync error", "Unable to register for Push notifications", null, "OK", null).Show();
            return;
        }
    });                 
}

      

However, if I replace the first line with this content, RegisterNativeAsync FAILS:

NSSet tags = new NSSet("Email-no email provided for some user");

      

I get this answer:

URLRequest failed for {URL: https://MYNAMESPACE.servicebus.windows.net/MYNOTIFICATIONHUBNAME/Registrations/7659656661665513594-8491925189141493076-8?api-version=2013-04 } with status: bad request

Are there rules for formatting tags? I have dozens of other tags with a lot of content types and have never encountered this problem before.

+3


source to share


1 answer


In the documentation:

The tag can be any string, up to 120 characters long, containing alphanumeric and the following non-alphanumeric characters: '_,' @, '#,'., ':,' -.



So, in your case, the spacebar is breaking things.

+6


source







All Articles