3

我在iOS上针对Azure通知中心使用Xamarin。事情一直很好。但是,最近我添加了一个新的TAG到我注册我的设备的标签集合中。Azure通知中心注册失败,出现一些标记格式

这里略,工程代码:

NSSet tags = new NSSet("[email protected]"); 
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; 
     } 
    });     
} 

但是,如果我与此内容替代所述第一线,所述RegisterNativeAsync失败:

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

我收到该响应:

网址:{URL:https://MYNAMESPACE.servicebus.windows.net/MYNOTIFICATIONHUBNAME/Registrations/7659656661665513594-8491925189141493076-8?api-version=2013-04}的URLRequest失败,状态码为:不良请求

是否有关于标签的格式化规则?我有许多其他标签有很多类型的内容,并从未遇到过这个问题。

回答

6

documentation

的标签可以是任意字符串,高达120个字符,包含字母数字和以下非字母数字字符: '_', '@', '#',”。 ',':',' - '。

所以在你的情况下空间打破了事情。

+0

哇......不知道我是怎么轻松地通过这些信息。我想我到目前为止一直很幸运没有在我的标签中存在非法内容! – 2014-10-17 00:44:44