jde*_*lin 4 c# apple-push-notifications pushsharp
我有使用PushSharp的Android和Apple推送通知,但我在使用Apple通知发送自定义数据时遇到问题.
这完美地发送:
push.QueueNotification(new AppleNotification()
.ForDeviceToken(device.Identifier)
.WithAlert(message)
.WithSound("default")
.WithBadge(7));
Run Code Online (Sandbox Code Playgroud)
这根本不起作用:
push.QueueNotification(new AppleNotification()
.ForDeviceToken(device.Identifier)
.WithAlert(message)
.WithSound("default")
.WithCustomItem("incidentId", new[] { 1 })
.WithBadge(7));
Run Code Online (Sandbox Code Playgroud)
后者永远不会遇到NotificationSent,NotificationFailed,ServiceException等,并且永远不会进入手机.
使用PushSharp版本2.0.4.0
我是否在尝试添加自定义数据时出错?
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"));
Run Code Online (Sandbox Code Playgroud)
2)尽量使用
WithCustomItem("incidentId", "1");
Run Code Online (Sandbox Code Playgroud)
3)可能原因是错误的声音文件名.我看到它没有扩展名.
| 归档时间: |
|
| 查看次数: |
3222 次 |
| 最近记录: |