Azure Service Bus通知中心的ios通知模板

Azure Service Bus通知中心的ios通知模板,第1张

概述我正在为ios使用 windows azure服务总线通知中心 我通过以下代码注册我的设备: SBNotificationHub* hub = [[SBNotificationHub alloc] initWithConnectionString: @"Endpoint=sb://......" notificationHubPa 我正在为ios使用 windows azure服务总线通知中心

我通过以下代码注册我的设备:

SBNotificationHub* hub = [[SBNotificationHub alloc] initWithConnectionString:                                  @"Endpoint=sb://......" notificationHubPath:@"...."];        NSMutableSet *set = [NSMutableSet set];        [set addobject:@"general"];        [hub registerNativeWithDevicetoken:devicetoken Tags:[set copy] completion:^(NSError* error) {            if (error != nil) {                NSLog(@"Error registering for notifications: %@",error);                [self.delegate homePopUpVIEwControllerEnterbuttonPress:self];            }        }];

并使用以下代码从.Net Backend发送通知:

var hubClIEnt = NotificationHubClIEnt.CreateClIEntFromConnectionString(<connection string>,"<notification hub name>");IDictionary<string,string> propertIEs = new Dictionary<string,string>();propertIEs.Add("badge","1");propertIEs.Add("alert","This is Test Text");propertIEs.Add("sound","bingbong.aiff");hubClIEnt.SendTemplateNotification(propertIEs,"general");

我能够收到通知但我的问题是:通知没有我添加的任何属性,没有声音,没有徽章……

如果你能帮助我

参考文献:http://msdn.microsoft.com/en-US/library/jj927168.aspx

谢谢

解决方法 您注册了本机通知,但随后您正在发送模板通知.
如果您想发送本机(如果您想要访问不同平台上的设备,则需要额外的发送),您必须使用

hub.SendAppleNativeNotification(    "{ \"aps\": { \"alert\": \"This is my alert message for iOS!\"}}","tag");

有关iOS有效载荷格式,请参阅https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html.

或者,您可以注册模板通知:

Nsstring* template = @"{aps: {alert: \"$(myToastProperty)\"}}";[hub registerTemplateWithDevicetoken:devicetoken                                 name:@"myToastRegistration"                    JsonBodyTemplate:template                      expiryTemplate:nil                                Tags:nil                           completion:^(NSError* error) {    if (error != nil) {        NSLog(@"Error registering for notifications: %@",error);    }}];

使用如下模板:

{   “aps”: {       “alert”: “$(alert)”   }}

然后,您可以像使用hub.SendTemplateNotification一样发送通知.

有关模板与本机之间差异的更多信息,请参阅:http://msdn.microsoft.com/en-us/library/jj927170.aspx

总结

以上是内存溢出为你收集整理的Azure Service Bus通知中心的ios通知模板全部内容,希望文章能够帮你解决Azure Service Bus通知中心的ios通知模板所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1052731.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存