OGeek|极客世界-中国程序员成长平台

标题: ios - 来自 WebApi 应用程序的 Apple 推送通知 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 09:35
标题: ios - 来自 WebApi 应用程序的 Apple 推送通知

我正在使用 PushSharp对于 Apple 推送通知,它正在 Windows 8 和 Windows Server 2008R2 上的控制台应用程序和 Windows 服务中工作,但在同一台计算机上传输到 WebApi 应用程序的相同代码不起作用。我已经通过 mmc 在 Personal(私钥可用,授予 IIS_USRS 的权限)和受信任的根证书颁发机构中安装了证书和私钥。 代码有点明显,但以防万一:

var push = PushBroker();
var appleCert = File.ReadAllBytes("C:\Users\Documents\Certificates\Push.p12");
push.RegisterAppleService(new PushSharp.Apple.ApplePushChannelSettings(false, appleCert, "pwd"));
PushSharp.Apple.AppleNotification notif = new PushSharp.Apple.AppleNotification()
    .ForDeviceToken("xxx")
    .WithAlert("Updated...")
    .WithBadge(1)
    .WithSound("default");
push.QueueNotification(notif);
//Wait for queue to finish
push.StopAllServices(true);

没有错误/异常等,只是 iPhone 设备在 WebApi 应用程序中启动时没有收到通知。



Best Answer-推荐答案


您是否检查了所有事件句柄是否有错误? PushBroker 实例上有很多它们,您可以在其中订阅以拦截错误(如果有的话)。

订阅:OnServiceExceptionOnNotificationFailed

检查 IIS|app|users|roles 是否拥有访问网络的所有权限。

关于ios - 来自 WebApi 应用程序的 Apple 推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26432992/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4