我开发了一个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!
证书既不是开发证书也不是生产证书,怎么可能呢?
有没有地方可以验证该文件?请给我一些关于这个问题的见解,因为我不知道从哪里开始。