0
iOS에서 앱이 종료되면 자동 푸시 알림을 받고 싶습니다. 그래서 앱에서 Push Kit 프레임 워크를 구현했습니다. 푸시 킷을 통해 알림을 보낼 수있는 방법이 있습니까? FCM 콘솔 또는 푸시 시도로 ...푸시 킷을 통해 알림을받을 수있는 방법이 있습니까?
iOS에서 앱이 종료되면 자동 푸시 알림을 받고 싶습니다. 그래서 앱에서 Push Kit 프레임 워크를 구현했습니다. 푸시 킷을 통해 알림을 보낼 수있는 방법이 있습니까? FCM 콘솔 또는 푸시 시도로 ...푸시 킷을 통해 알림을받을 수있는 방법이 있습니까?
FCM은 자동 푸시 알림을 지원하지 않습니다.
Does Firebase Cloud Messaging support VOIP pushkit services?
당신은 PHP 파일 및 터미널 명령 아래로 사용해 볼 수 있습니다.
PHP 파일
<?php
// Put your device token here (without spaces):
$deviceToken = '123456789';
//
// Put your private key's passphrase here:
$passphrase = 'ProjectName';
// Put your alert message here:
$message = 'My first silent push notification!';
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'PemFileName.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
// Open a connection to the APNS server
$fp = stream_socket_client(
// 'ssl://gateway.push.apple.com:2195', $err,
'ssl://gateway.sandbox.push.apple.com:2195', $err,
$errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
if (!$fp)
exit("Failed to connect: $err $errstr" . PHP_EOL);
echo 'Connected to APNS' . PHP_EOL;
// Create the payload body
$body['aps'] = array(
'content-available'=> 1,
'alert' => $message,
'sound' => 'default',
'badge' => 0,
);
// Encode the payload as JSON
$payload = json_encode($body);
// Build the binary notification
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
// Send it to the server
$result = fwrite($fp, $msg, strlen($msg));
if (!$result)
echo 'Message not delivered' . PHP_EOL;
else
echo 'Message successfully delivered' . PHP_EOL;
// Close the connection to the server
fclose($fp);
사용 아래 PEM 파일을 만들고 위의 코드에서 사용하는 명령
$ openssl x509 -in aps_development.cer -inform der -out PushCert.pem
// Convert .p12 to .pem. Enter your pass pharse which is the same pwd that you have given while creating the .p12 certificate. PEM pass phrase also same as .p12 cert.
$ openssl pkcs12 -nocerts -out PushKey1.pem -in pushkey.p12
Enter Import Password:
MAC verified OK
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
// To remove passpharse for the key to access globally. This only solved my stream_socket_client() & certificate capath warnings.
$ openssl rsa -in PushKey1.pem -out PushKey1_Rmv.pem
Enter pass phrase for PushChatKey1.pem:
writing RSA key
// To join the two .pem file into one file:
$ cat PushCert.pem PushKey1_Rmv.pem > ApnsDev.pem
전화 서비스를 사용하지 않으면 애플이 앱을 수락합니까 ?? –
아니요, VOIP 기능이 없으면 사과를 수락하지 않습니다. VoIP 기능이 있어야하거나 앱이 건강 관리, 위치 기반 또는 특정 항목과 같은 특정 카테고리에 있어야하며 사과로부터 사전 허가를 받아야합니다. – Hasya
도움이 될 경우 내 답변을 수락 할 수 있습니다. – Hasya