0

我目前正在编写一个允许用户向通行证发送推送通知的存折 API。现在我正在测试它,但我的推送通知没有到达。我正在用 PHP 编写推送发送代码,这就是我目前所拥有的:

$payload = json_encode(array("aps" => array("alert" => "test", "sound" => "default")));
//send it to all devices found
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) 
{
    error_log($row['pushToken']);
    //write the push message to the apns socket connection
    $msg = chr(0) .
    pack("n",32) .
    pack('H*', $row['pushToken']) .
    pack("n",strlen($payload)) .
    $payload;
    fwrite($fp, $msg);
}

我在这里有什么遗漏或做错了吗?证书有效并且连接到 APNS 服务器不会给我任何错误。

谢谢!

4

1 回答 1

0

我通过重新创建证书、再次执行 openssl 魔术并使用新证书解决了这个问题。现在它正在工作,所以我认为我的证书中有一些错误:)

于 2012-10-08T18:05:01.997 回答