Googleには、AndroidとiOSの両方にプッシュ通知を送信するPHPのアプリケーションが組み込まれています。私たちの問題は、iOSのデバイスIDがスクリプト内の他のすべてのiOSプッシュ通知の送信を完全に停止しているように見えることです。エラーなしで送信されたとしても、その後ループ内のすべての通知を停止します。iOSアプリケーションのプッシュ通知
違反しているデバイスIDをデータベースから削除すると、送信スクリプトは問題のあるデバイスの後のすべてのデバイスで機能します。それは非常に奇妙で、なぜそれを理解していないようです。
誰もこの経験がありますか?それがもう存在しないデバイスIDに送信することは、Appleが特定の接続でスクリプトを完了するのを止めるでしょうか?
$tHost = 'gateway.push.apple.com';
$tPort = 2195;
$tCert = "path_to_our_cert.pem";
$tPassphrase = 'passphrase';
$tAlert = $this->title; //assign a title
$tBadge = 8;
$tSound = 'default';
$tPayload = $this->body_plain; //assign a body
// Create the message content that is to be sent to the device.
$tBody['aps'] = array ('alert' => $tAlert,'badge' => $tBadge,'sound' => $tSound,);
$tBody ['payload'] = $tPayload;
$tBody = json_encode ($tBody);
$tContext = stream_context_create();
stream_context_set_option ($tContext, 'ssl', 'local_cert', $tCert);
stream_context_set_option ($tContext, 'ssl', 'passphrase', $tPassphrase);
$tSocket = stream_socket_client ('ssl://'.$tHost.':'.$tPort, $error, $errstr, 30, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $tContext);
if (!$tSocket) exit ("APNS Connection Failed: $error $errstr" . PHP_EOL);
//Loop through all devices to send
foreach($this->device->devices as $item){
if($item->os != "iOS") continue;
if(session::getAdministratorStaffSchoolID() != $item->school_id) continue;
$tToken = $item->device_id;//assign the device id
$tMsg = chr (0) . chr (0) . chr (32) . pack ('H*', $tToken) . pack ('n', strlen ($tBody)) . $tBody;
$tResult = fwrite ($tSocket, $tMsg, strlen ($tMsg));
}
fclose ($tSocket);
誰もこれについての任意のアイデアを持っています。ここでは
は、PHPで私たちの送信スクリプトは(これは離れて奇数不正なデバイスIDからすべてのデバイスのために働く)とは?
感謝