3

I'm using Xamarin on iOS against an Azure Notification hub. Things have been working fine for a while. But, I recently added a new TAG to a collection of tags that I register my devices against.

Here is abbreviated code that WORKs:

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, the RegisterNativeAsync FAILS:

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

I receive this response:

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

Are there formatting rules about tags? I have dozens of other tags with lots of types of content and have never run into this issue before.

Nate Jackson
  • 549
  • 4
  • 15

1 Answers1

6

From the documentation:

A tag can be any string, up to 120 characters, containing alphanumeric and the following non-alphanumeric characters: ‘_’, ‘@’, ‘#’, ‘.’, ‘:’, ‘-’.

So in your case space breaks the things.

efimovandr
  • 1,594
  • 9
  • 11
  • Wow...not sure how I breezed over that info. I guess I've been lucky so far not to have illegal content in my tags! – Nate Jackson Oct 17 '14 at 00:44