iOS FCM 푸시메세지 관련 문의드립니다

조회수 1429회

fcm 문서대로 푸쉬메세지 구현하였고,

fcm 사이트에서 Notifications 기능으로 메세지를 보내면 잘 받는것을 확인했습니다.

그런데 문제는, php 로 서버구현해놓았는데

요걸 이용해서 보내면 ios는 메세지가 오지않습니다.

안드로이드는 메시지 수신이 잘됩니다.. 어떤부분을 확인해봐야할까요..?

php 서버 코드입니다

$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array(
'registration_ids' => $tokens,
'data' => $message
);
$headers = array(
'Authorization:key =' . GOOGLE_API_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
curl_close($ch);

swift쪽은 github에있는 예제 그대로 사용하였습니다

  • (•́ ✖ •̀)
    알 수 없는 사용자

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)