i've strange behavior in app. first push notification send delivered. other won't arrive. waited 1 week, , still wasn't delivery. if reinstall app, first notification delivered instantaneously.
i never had problem before. other apps working apns.
thanks,
maik
edit:
<?php // put device token here (without spaces): $devicetoken = 'token'; // put private key's passphrase here: $passphrase = 'pw'; // put alert message here: $message = 'message'; //////////////////////////////////////////////////////////////////////////////// $ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem'); stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase); // open connection apns server $fp = stream_socket_client( 'ssl://gateway.push.apple.com:2195', $err, $errstr, 60, stream_client_connect|stream_client_persistent, $ctx); if (!$fp) exit("failed connect: $err $errstr" . php_eol); echo 'connected apns' . php_eol; // create payload body $body['aps'] = array( 'alert' => $message, 'sound' => 'default' ); // encode payload json $payload = json_encode($body); // build binary notification $msg = chr(0) . pack('n', 32) . pack('h*', $devicetoken) . pack('n', strlen($payload)) . $payload; // send server $result = fwrite($fp, $msg, strlen($msg)); if (!$result) echo 'message not delivered' . php_eol; else echo 'message delivered' . php_eol; // close connection server fclose($fp);
(i tested development , production push)
fixed it, created new app id. think problem was, deleted appid old account , created on new developer account.
Comments
Post a Comment