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