我想向 iOS 设备发送测试 PUSH 消息。我获得了设备 token 和一个 .pem
文件作为证书。但我似乎找不到使用此 .pem
文件创建新 ApplePushChannelSettings
对象的方法。网上的例子都是用.p12
文件,里面有密码。
//Create our push services broker
var push = new PushBroker();
//Registering the Apple Service and sending an iOS Notification
var appleCert = File.ReadAllBytes("ApnsSandboxCert.p12"));
push.RegisterAppleService(new ApplePushChannelSettings(appleCert, "pwd"));
push.QueueNotification(new AppleNotification()
.ForDeviceToken("DEVICE TOKEN HERE")
.WithAlert("Hello World!")
.WithBadge(7)
.WithSound("sound.caf"));
我应该为目标应用程序请求一个.p12
证书,还是有办法将.pem
文件与PushSharp 一起使用?
最佳答案
根据我的经验,所有推送通知服务都需要一个.p12
证书。你应该试试看。
编辑:
经过quick search ,我认为你别无选择。 .p12
是。
关于c# - 使用 .pem 证书注册 Apple 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30592107/