gpt4 book ai didi

c# - PushSharp WithCustomItem 发送失败

转载 作者:太空狗 更新时间:2023-10-30 01:05:59 26 4
gpt4 key购买 nike

我的 Android 和 Apple 推送通知与 PushSharp 配合使用,但我无法通过 Apple 通知发送自定义数据。

这发送完美:

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

我尝试添加自定义数据的方式是否有问题?

最佳答案

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) 可能是声音文件名错误。我看到它没有扩展名。

关于c# - PushSharp WithCustomItem 发送失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16888115/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com