I am playing with apples Passbook service. I have a really strange behaviour on all devices. If I send a push via APNS to the device to let them know that there is a update for a certain pass they do the update but they do not show any notification on the Lockscreen on the device.
Right now I am logging the whole communication between my PHP-Webservice and the APNS. I always answer with headre 200, and the requested answer. (1st Serials; 2nd Pass.pkpass) and the device does the update as I can see in the passbook app but as I already said I do not get any Notification on the Lockscreen. The Device is set up correctly as described in this article: a link
and I do my APNS Request like this:
public function sendePushNotification($passTypeID, $debug = true)
{
// Zertifikat vorhanden ?
$certFullPath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "api/cert/ck.pem";
if (file_exists($certFullPath))
{
/**
* Payload vorbereiten
*/
$message = 'PASSDROP UPDATE';
$body = array();
$body['aps'] = array('alert' => $message);
/**
* Host bestimmen
*/
$apnsHost = "gateway.push.apple.com"; // Development Umgbung
/**
* Stream erstellen
*/
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $certFullPath);
$fp = stream_socket_client('ssl://' . $apnsHost . ':2195', $err, $errstr, 2, STREAM_CLIENT_CONNECT, $ctx);
if (!$fp)
{
echo "Fehler beim APNS: " . $err . " / ". $errstr. "\n";
return false;
}
/**
* Payload versenden
*/
$payload = json_encode($body);
$msg = chr(0) . pack("n",32) . pack('H*', str_replace(' ', '', $this->token)) . pack("n",strlen($payload)) . $payload;
}
else
{
throw new Exception("Zertifikat-Bundle " . $certFullPath . " existiert nicht !!!");
}
}
As far as I know Apple does not read the payload when pushing a Pass in Passbook.
Does anybody have a hint for me what I can try next? Do I need anything in the pass.json file?