APNS推送通知不工作的生产 [英] APNS Push Notifications Not Working on Production
问题描述
我创建了一个应用程序从一个Web服务器发送远程通知。
当我在开发模式下测试应用程序的所有通知正确到达的电话,在AppStore发布的应用程序没有收到通知后了。
I created an App to send remote notifications from a web server. When I tested the App in Development Mode all the notifications arrived correctly on the phone, after the AppStore release the app did not receive notifications anymore.
这是我做过什么:
- 创建一个私钥生产和一个用于开发。
- 通过传递产生了previous CERTFILE生成于我的应用程序ID的两个SSL证书。我敢肯定,已经产生正确的2键100%,并通过他们正确地下载从开发中心的SSL证书的AppID下。
- 创造了发展,一个用于生产一个文件质子交换膜(通过转换文件.P12从我的钥匙串等等等等中提取)。
- 创建2不同供应配置文件一个用于开发和一个用于连接到所述的AppID步骤1的产
- 登录生成设置应用程序与步骤4中创建正确的配置配置文件。
- 创建了一个Web应用程序来捕捉和存储用户令牌。
- 创建一个PHP页面来测试推送通知发送。
这是我的测试:
- 测试的发展产生的质子交换膜通过telnet文件的沙箱链接与succesfull回答。
- 测试的生产过程中产生质子交换膜与具有succesfull答案生产环节的telnet文件。
- 我100%肯定已存储在我的网站上的应用程序我的iPhone的发展令牌。
- 我敢肯定有存储我的web应用服务器我的iPhone的生产令牌100%。
- 我100%肯定我的PHP页面传递正确的信息给苹果服务器(无论是开发和生产)。
- PHP页面总是(包括开发和生产)返回从苹果服务器一succesfull消息。
下面是我如何签署X code中的应用:
Here is how I sign the app on Xcode:
下面是PHP页面code发送通知:
Here is the code of the php page to send notifications:
$ctx = stream_context_create();
//stream_context_set_option($ctx, 'ssl', 'passphrase', 'development_pwd');
//stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck_development.pem');
//$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); //test
stream_context_set_option($ctx, 'ssl', 'passphrase', 'production_pwd');
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck_production.pem');
$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); //production
echo "<p>Connection Open</p>";
if(!$fp){
echo "<p>Failed to connect!<br />Error Number: " . $err . " <br />Code: " . $errstrn . "</p>";
return;
} else {
echo "<p>Sending notification!</p>";
}
$i = 0;
foreach ($deviceToken as $dt) {
$dt = str_replace(' ' , '' , $dt);
$msg = chr(0) . pack('n',32) . pack('H*', $dt) . pack('n',strlen($payload)) . $payload;
echo "<p>" . $i . " - Message sent: " . $payload . "<br />Token: ". $dt . "<br />***" . $msg . "***</p>";
$result = fwrite($fp, $msg, strlen($msg));
$i++;
if (!$result)
echo '<p>Message not delivered ' . PHP_EOL . '!</p>';
else
echo '<p>Message successfully delivered ' . PHP_EOL . '!</p>';
}
fclose($fp);
echo "<p>Total Notifications Sent: " . $i . "</p>";
echo "<p>Connection Closed!</p>";
}
?>
结论:
我有我的电脑接收APNS推送通知的测试应用程序。
我已经发布的应用程序商店是没有收到APNS推送通知完全相同的应用程序。
Conclusions: I have the Test App on my PC that receive APNS Push Notifications. I have the exactly same app released on App Store that not receive APNS Push Notifications.
我真的在我的力量来解决这个问题,阅读上千页的论坛,计算器和苹果之证件。
I realy made everything in my power to fix this issue and read about thousand pages of forums, stackoverflow and Apple Documentations.
我愿意retribuite你们大家谁帮我找到解决我的问题!
推荐答案
你提到的链接是沙箱APNS链接。生产APNS链接按苹果<一个href=\"https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ProvisioningDevelopment.html#//apple_ref/doc/uid/TP40008194-CH104-SW2\">documentation是:
The link you mentioned is Sandbox APNS link. Production APNS link is as per Apple documentation is:
您在 gateway.push.apple.com 进入生产环境,
出站TCP端口2195。
You access the production environment at gateway.push.apple.com, outbound TCP port 2195.
几件事情要验证:
- 您的AppId为分布APNS启用。
- 您已经创建分布APNS SSL证书和安装在构建机器(用于应用程序商店提交)。
- 您已经在步骤2在服务器上安装SSL证书。
- 您不是通过使用开发APNS的SSL证书的错误。
这篇关于APNS推送通知不工作的生产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!