PushSharp无法识别APN生产证书

LcS*_*zar 12 certificate apple-push-notifications ios pushsharp

我开发了一个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();
Run Code Online (Sandbox Code Playgroud)

现在,该应用已获批准,它位于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();
Run Code Online (Sandbox Code Playgroud)

但是当我尝试从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!
Run Code Online (Sandbox Code Playgroud)

我很确定我已经完成了所有步骤.我已经下载了与应用程序中设置的配置文件绑定的生产证书以进行发布.打开它并导出.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!
Run Code Online (Sandbox Code Playgroud)

证书既不是开发也不是生产?

有什么地方我可以验证文件吗?请告诉我一些关于此事的问题,因为我不知道从哪里开始

tea*_*eng 16

Apple改名了.请转到ApplePushChannelSettings.cs并更改名称,如下所示.

if (production && !subjectName.Contains("Apple Production IOS Push Services"))
Run Code Online (Sandbox Code Playgroud)

if (production && !subjectName.Contains("Apple Push Services"))
Run Code Online (Sandbox Code Playgroud)

我昨天更新过期的证书时需要这样做.更改名称,重建名称并上传到服务器,然后再次运行.


Ala*_*jar 0

请按照以下链接中的步骤生成生产 SSL 证书:

如何创建 APNS 证书

如果这不起作用,请仔细检查您的代码,确保您正在读取正确的证书文件,然后传递TrueApplePushChannelSettings