[英]Apple Production Push Notification certificate do not connect after new app version
[英]Not Getting Push Notification for Production Certificate
我已經閱讀了有關此主題的許多答案,但問題未通過建議的解決方案解決。 我的問題是我沒有收到生產證書的推送通知。 相同的推送通知已成功獲取開發證書。 我特別想說的是,我用於生產和開發環境的設備令牌完全不同。 因此,相同的設備令牌沒有問題。 另外,我為兩者使用不同的配置文件。 就是說,在應用程序級別上沒有配置問題。
我們將PHP用作發送推送通知的服務器。
這是我的兩個問題:
我將非常感謝大家。 我被困在這個問題上。 提前謝謝了
檢查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);
}
我遇到了同樣的問題。 如果您的.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.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.