【发布时间】:2012-09-22 17:00:28
【问题描述】:
我在开发人员模式下成功地将 APN 与我的应用程序一起使用,但我无法让它在 adhoc 分发模式下工作。
我忠实地遵循了教程http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12,并且我已经阅读了关于这个问题的所有其他帖子,我可以在 SO 和其他地方找到。
在开发人员模式下,我创建 cer 和 p12 pem 文件并将它们组合起来:当我尝试时: openssl s_client -connect gateway.push.apple.com:2195 -cert aps_production.cer.pem -key MyPrivateKey.p12.pem,我得到:
depth=1 /C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
verify error:num=20:unable to get local issuer certificate
verify return:0
-----BEGIN CERTIFICATE-----
(certificate deleted)
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=Cupertino/O=Apple Inc./OU=iTMS Engineering/CN=gateway.push.apple.com
issuer=/C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
---
No client certificate CA names sent
---
SSL handshake has read 2723 bytes and written 2140 bytes
---
New, TLSv1/SSLv3, Cipher is AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : AES256-SHA
Session-ID:
Session-ID-ctx:
Master-Key: (deleted)
Key-Arg : None
Start Time: 1348332242
Timeout : 300 (sec)
Verify return code: 0 (ok)
我不知道“verify error:num=20:unable to get local issuer certificate”是什么意思,也不知道它是否重要。当我将 gateway.sandbox.push.apple.com:2195 与我的开发人员 cer 和密钥一起使用时,我得到了同样的结果,但它工作正常。
当我在手机上使用 simplepush.php 和开发人员版本的应用程序时。通知工作完美。当我在临时分发和手机上的应用程序的临时分发版本中使用相同的版本时,尽管 simplepush.php 返回,但我什么也没得到: "向 APNS 发送消息"
我查询了反馈服务,没有报错。
其他人建议,如果应用程序未经 Apple 批准,APNS 不适用于 adhoc 模式。那是问题吗?我们的应用仍在审核中。
感谢您的帮助。
【问题讨论】:
-
我的推送通知适用于 ad-hoc dist 构建和 appstore dist 构建,以及 dev 构建。您一定是在某处使用了错误的文件,或者缺少某些东西。我建议您从 Ray 网站上的说明重新开始,并多次检查您在做什么,simplepush.php 的内容和您连接到的服务器名称也是如此。 (例如,sandbox.push 等)
-
我终于可以让它工作了。甚至以为我已经不止一次这样做了,我重新开始了。清除证书,重新下载,重新转换为 pem 等。创建了一个新的应用程序存档。现在它起作用了。我不知道哪一步有所作为。如果它可以帮助其他人注意,即使成功测试 gateway.push.apple.com:2195 获得“验证错误:num = 20:无法获得本地颁发者证书”似乎并不重要。
-
哪个对 adhoc 构建正确,gateway.push.apple.com:2195 或 gateway.sandbox.push.apple.com:2195 ?
标签: ios push-notification ad-hoc-distribution