首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PushSharp WithCustomItem发送失败

PushSharp WithCustomItem发送失败
EN

Stack Overflow用户
提问于 2013-06-03 07:01:25
回答 1查看 3.2K关注 0票数 4

我可以在PushSharp上使用安卓和苹果的推送通知,但我在用苹果通知发送自定义数据时遇到了麻烦。

这完美地发送了:

代码语言:javascript
复制
push.QueueNotification(new AppleNotification()
                                   .ForDeviceToken(device.Identifier)
                                   .WithAlert(message)
                                   .WithSound("default")
                                   .WithBadge(7));

这根本不起作用:

代码语言:javascript
复制
push.QueueNotification(new AppleNotification()
                                   .ForDeviceToken(device.Identifier)
                                   .WithAlert(message)
                                   .WithSound("default")
                                   .WithCustomItem("incidentId", new[] { 1 })
                                   .WithBadge(7));

后者永远不会访问NotificationSent、NotificationFailed、ServiceException等,也不会出现在手机上。

使用PushSharp版本2.0.4.0

我尝试添加自定义数据的方式是不是做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-03 07:58:28

1)您是否在ApplePushChannelSettings中设置了生产环境(不是沙箱)?

代码语言:javascript
复制
//Create our push services broker
var push = new PushBroker();

//Registering the Apple Service and sending an iOS Notification
var appleCert = File.ReadAllBytes("YourCert.p12"));

//isProduction - development or ad-hoc/release certificate
push.RegisterAppleService(new ApplePushChannelSettings(isProduction, appleCert, "pwd"));

2)尝试使用

代码语言:javascript
复制
WithCustomItem("incidentId", "1");

3)可能是声音文件名有误。我发现它没有扩展名。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16888115

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档