[英]Not Getting Push Notification for Production Certificate
I have read many answers on this topic but issue not resolved by suggested solutions. 我已经阅读了有关此主题的许多答案,但问题未通过建议的解决方案解决。 My issue is that I am not getting Push Notifications for Production Certificate.
我的问题是我没有收到生产证书的推送通知。 Same Push Notifications are successfully getting in Development certificate.
相同的推送通知已成功获取开发证书。 I specially want to say that my device tokens for production and development environment is entirely different.
我特别想说的是,我用于生产和开发环境的设备令牌完全不同。 So there is no issue for same device token.
因此,相同的设备令牌没有问题。 Also, i am using different profiles for both.
另外,我为两者使用不同的配置文件。 Means to say, there is not configuration issue on app level.
就是说,在应用程序级别上没有配置问题。
We are using PHP as a server that is sending push notifications. 我们将PHP用作发送推送通知的服务器。
Here are my two questions: 这是我的两个问题:
I will be very thankful to all of you. 我将非常感谢大家。 I am stuck on this issue.
我被困在这个问题上。 Many Thanks in advance
提前谢谢了
check php function for iphone push notification... 检查php功能以获取iPhone推送通知...
function iphone_notification($deviceToken,$message,$not_type,$sound,$vibration_type){
$passphrase = '******';
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
$body['aps'] = array('alert' => $message, 'sound' => $sound);
$body['notification_type'] = $not_type;
$body['vibration_type'] = $vibration_type;
//1 = news;
//99 = other;
//echo $err."<br>".$errstr;
$payload = json_encode($body);
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
$result = fwrite($fp, $msg, strlen($msg));
fclose($fp);
}
I faced this same problem. 我遇到了同样的问题。 If your .pem file is correct then using following setting you will get push notification.
如果您的.pem文件正确,则使用以下设置,您将收到推送通知。 ( check terminal commands to make .pem )
( 检查终端命令以使.pem )
//for development profile
$apns_url = 'gateway.sandbox.push.apple.com';
//for production you should use this
$apns_url = 'gateway.push.apple.com';s.
for more detail check this link1 >> link2 >> 有关更多详细信息,请检查此链接1 >>链接2 >>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.