苹果推送通知是不工作的分布,但发展工作 [英] Apple push notification is not working for distribution but working for development

查看:169
本文介绍了苹果推送通知是不工作的分布,但发展工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现推送通知我的应用程序,在开发这部分工作正常,我收到推送通知好。当我决定将它发布在App Store中,我实现了它的分布(我用的证书和发行配置文件),我犯了同样的步骤,我转换中.P12文件为.pem通过,应当和我结合certificate.pem和key.pem到另一个文件ck.pem。
在PHP文件,我做了以下内容:

I am implementing push notifications in my application, in the development part it is working fine, and I receive push notifications well. When I decided to publish it in the app store, I implemented it for distribution (I use the certificate and provisioning profile for distribution), I made the same steps and I converted the .p12 files to .pem through shall, and I combine the certificate.pem and key.pem to another file ck.pem. In the PHP file, I did the following:

$passphrase = 'The passphrase I put it in the shall';

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);

// Open a connection to the APNS server
$fp = stream_socket_client(
    'ssl://gateway.push.apple.com:2195', $err,
    $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);

在我的PHP 2195

I already changed sandbox to ssl://gateway.push.apple.com:2195 in my php.

我已经改变了沙箱SSL://gateway.push.apple.com。

我创建production.pem这个步骤。

I created production.pem with this steps.

$ openssl x509 -in aps_developer_identity.cer -inform der 
    -out PushChatCert.pem

$ openssl pkcs12 -nocerts -out PushChatKey.pem -in PushChatKey.p12

Enter Import Password: MAC verified OK Enter PEM pass phrase: Verifying - Enter PEM pass phrase:

$ cat PushChatCert.pem PushChatKey.pem > ck.pem

和我uploade我ck.pem到我的共享主机。这是没有什么错误,但它不会推送通知。

and I uploade my ck.pem to my shared host. It is nothing errors but it does not push notification.

在我的PHP它说:连接到成功交付APNS消息

In my php it said : Connected to APNS Message successfully delivered

推荐答案

我相信,在服务器端不使用分发PEM文件。主要的基本原则是应用程序和服务器应该在同一mode.If您的应用程序在调试模式下运行,然后服务器也应该用发展的PEM文件和同样喜欢,如果你的应用程序在释放模式运行,那么服务器也应该使用分配PEM文件中。

I believe in server side not using the distribution PEM file. The main fundamental rule is App and server should run in same mode.If your app is running in debug mode then server also should also use the development PEM file and same like if your app is running in release mode then server also should use distribution PEM file.

这篇关于苹果推送通知是不工作的分布,但发展工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆