【发布时间】:2017-07-20 19:13:17
【问题描述】:
iOS 上的 Firebase 通知有一个奇怪的问题。它工作得很好,但唯一的问题是,如果我将服务器上的“body”参数保持为空,它会在应用程序上播放通知声音但不显示任何内容。同样的事情在 Android 上显示通知。这是我遇到的某种 Apple 安全措施吗?如果我只在'body'中添加一个空白空间“”,它会显示出来,但没有它就什么都没有。如果有任何机构可以建议我什么,请。 我的服务器端代码
$msg = array
(
'title' => '',
'body' => ' ',
'click_action' => '.InstagramLoader',
'icon' => 'myicon',/*Default Icon*/
'sound' => 'mySound'/*Default sound*/
);
$data = array(
'text' => $title,
'img_url' => $img_url
);
$fields = array
(
'to' => $registrationIds,
'notification' => $msg,
'data' => $data
);
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
#Send Reponse To FireBase Server
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close( $ch );
【问题讨论】:
-
这篇文章讨论了一个类似的问题stackoverflow.com/questions/45214234/…
标签: ios swift firebase apple-push-notifications firebase-notifications