gpt4 book ai didi

ios - PushSharp 未识别 APN 生产证书

转载 作者:技术小花猫 更新时间:2023-10-29 10:31:28 24 4
gpt4 key购买 nike

我开发了一个 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!

我很确定我已经完成了所有步骤。我已经下载了与要发布的应用程序中设置的配置文件绑定(bind)的生产证书。打开它并导出 .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?

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

最佳答案

Apple 已更改名称。请转到 ApplePushChannelSettings.cs 并按如下所示更改名称。

来自

if (production && !subjectName.Contains("Apple Production IOS Push Services"))

if (production && !subjectName.Contains("Apple Push Services"))

我昨天更新过期证书时需要这样做。更改名称,重建它并上传到服务器,然后它又可以工作了。

关于ios - PushSharp 未识别 APN 生产证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28499395/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com