【发布时间】:2015-04-14 11:35:22
【问题描述】:
我开发了一个接收推送通知的 iOS 应用。我正在使用 PushSharp 从 .NET 环境中发送它们。开发过程中一切顺利,推送成功发送:
var push = new PushBroker();
var appleCert = File.ReadAllBytes(@"Utils\Cert.Development.p12");
push.RegisterAppleService(new ApplePushChannelSettings(false, appleCert, "*******"));
push.QueueNotification(new AppleNotification()
.ForDeviceToken(token)
.WithContentAvailable(1)
);
push.StopAllServices();
现在,该应用已获得批准,并且在 AppStore 中。我已经生成了正确的生产证书:
var push = new PushBroker();
var appleCert = File.ReadAllBytes(@"Utils\Cert.Production.p12");
push.RegisterAppleService(new ApplePushChannelSettings(true, appleCert, "*******"));
push.QueueNotification(new AppleNotification()
.ForDeviceToken(token)
.WithContentAvailable(1)
);
push.StopAllServices();
但是当我尝试从 PushSharp 发送推送时,它会引发以下异常:
You have selected the Production server, yet your Certificate does not appear to be the Production certificate! Please check to ensure you have the correct certificate!
我很确定我已经完成了所有步骤。我已经下载了与要发布的应用程序中设置的配置文件绑定的生产证书。打开它并导出 .p12。
我也确定我不是偶然使用开发工具,因为如果我将 PushSharp 设置为开发,使用最后一个证书,它会引发以下错误:
You have selected the Development/Sandbox (Not production) server, yet your Certificate does not appear to be the Development/Sandbox (Not production) certificate! Please check to ensure you have the correct certificate!
证书怎么可能既不是开发也不是生产?
有什么地方可以验证文件吗?请给我一些关于这个问题的见解,因为我不知道从哪里开始
【问题讨论】:
-
我遇到了同样的问题。你能在哪里让它工作?您是否尝试过关闭证书检查?
-
这是什么版本的 PushSharp? 2.X.X?
标签: ios certificate apple-push-notifications pushsharp