我开发了一个接受推送通知的iOS应用程序.我使用PushSharp从.NET环境发送它们.一切都在发展中精美,Pushs成功发送:
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,"*******")); push.QueueNotification(new AppleNotification() .ForDeviceToken(token) .WithContentAvailable(1) ); push.StopAllServices();
但是当我尝试从PushSharp发送push时,会引发以下异常:
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!
证书既不是发展也不是生产?
有什么地方可以验证文件吗?请给我一些关于这件事情的疑虑,因为我不知道从哪里开始
解决方法
苹果已经改名了.请转到ApplePushChannelSettings.cs并更改名称如下.
从
if (production && !subjectName.Contains("Apple Production IOS Push Services"))
至
if (production && !subjectName.Contains("Apple Push Services"))
我昨天更新我过期的证书时需要这样做.更改名称,重建并上传到服务器,然后再次运行.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。