我可以在PushSharp上使用安卓和苹果的推送通知,但我在用苹果通知发送自定义数据时遇到了麻烦。
这完美地发送了:
push.QueueNotification(new AppleNotification()
.ForDeviceToken(device.Identifier)
.WithAlert(message)
.WithSound("default")
.WithBadge(7));这根本不起作用:
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
我尝试添加自定义数据的方式是不是做错了什么?
发布于 2013-06-03 07:58:28
1)您是否在ApplePushChannelSettings中设置了生产环境(不是沙箱)?
//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)尝试使用
WithCustomItem("incidentId", "1");3)可能是声音文件名有误。我发现它没有扩展名。
https://stackoverflow.com/questions/16888115
复制相似问题