问题描述
我已经为此工作了一段时间.我知道那里有很多文章,而且我对这一切都了解了很多.
I've been working on this for a while now.I know there's a ton of articles out there, and have learned a lot about it all.
我以同样的方式创建了我的开发和生产 SSL.开发连接到 ssl://gateway.sandbox.push.apple.com:2195生产连接到 ssl://gateway.push.apple.com:2195连接似乎工作正常.
I have created my development and production SSL's the same way.Development connects to ssl://gateway.sandbox.push.apple.com:2195Production connects to ssl://gateway.push.apple.com:2195The connections seem to work fine.
至于应用程序.发展:当我从 xCode 直接在我的设备上运行它时,它运行开发版本.应用程序成功在数据库中记录了开发令牌.然后我运行一个服务来发送一个推送通知,它被正确传递.味精发送成功.
As for the app.Development:When I run it directly on to my device from xCode, it runs the development version. The app successfully records the development token in the database. I then run a service to send a push notification, and it is delivered correctly. The msg is successfully delivered.
临时:当我构建存档并将其导出以供临时分发时,我会仔细检查包内容 codesign -dvvvv --entitlements - Elepago.app
并查看 aps-environment 是否正确设置为生产.我将它打包并通过 iTunes 加载到我的设备上.当应用程序启动时,我看到数据库中记录了新的生产令牌.所以必须正确设置环境.当我将推送通知发送到生产密钥(与开发相同,只是更改 SSL .pem 密钥和服务器)时,它表示已成功交付.然而它从未真正到达设备!!!
Ad-hoc:When I build an archive and export it for Ad-hoc distribution, I double check the package contents codesign -dvvvv --entitlements - Elepago.app
and see that the aps-environment is correctly set to production. I package it and load it onto my device through iTunes. When the app starts, I see the new production token recorded in the database. So the environment must be correctly set up. When I send the push notification to the production key (identically the same as development, just changing the SSL .pem key and the server), it says it is successfully delivered. However it never actually reaches the device!!!
这个问题让我发疯.我刚刚完成并清理了我的分发证书,并使用全新的 CSR 重建了它.我还更新了所有配置文件以使用该新证书.[任何想法如何将这些证书绑定到应用程序中,除了我已经检查过的 aps-environment 内容.]
This problem is driving me crazy. I just went through and cleaned out my distribution certificate and rebuilt it using a completely new CSR. I also updated all the provisioning profiles to use that new certificate. [Any ideas how these certificates tie into the app, other than for the aps-environment thing which I already check.]
任何见解将不胜感激.
推荐答案
所以经过几个小时的头痛之后,我最终重建了 SSL .pem 文件并且成功了!!
So after hours and hours of headaches, I ended up rebuilding the SSL .pem file and it worked!!
这是我所做的:
- 擦干净我的分发证书并创建一个新的
- 将所有配置文件关联到新证书
- 在 xCode 中加载了新的配置文件
- 按照 Raywenderlich 的精彩教程
这些是我最初在开发和生产中遵循的相同说明,但可能/显然搞砸了.然后我在我的临时版本上进行了测试,它奏效了!!!
These are the same instructions I had originally followed for development and production, but maybe/apparently messed something up. Then I tested on my ad-hoc version and it worked!!!
另外,值得注意的是,当使用错误的 .pem 密钥时,我没有收到来自 APNS 的任何错误反馈.我使用上面链接中的 simplepush.php 文件作为发送 PN 的基础.
Also, its worth noting that when using the wrong .pem key, I was not receiving any error feedback from APNS. I use the simplepush.php file found in the link above as a base to send the PN.
这篇关于iPhone iOS 推送通知在生产中未发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!