0
我尝试将推送通知发送到我的科尔多瓦IOS应用程序。发送推送IOS上的FCM通知
我使用的插件cordova-plugin-fcm
对于我的Android应用它的工作完美,问题是对于iOS,我的卷曲请求返回:
InvalidApnsCredential
我上传我的APN关键在FCM和这项关键工作,因为我试图发送一个推送通知只是Apns,它的工作正常我的应用程序收到通知。
这里APNS脚本谁的工作:http://thrysoee.dk/apns/
这里我的PHP脚本卷曲用机器人而不是依奥斯FCM至极的工作:
$pushUrl = "FCM_PUSH_URL"; //https://fcm.googleapis.com/fcm/send
$key = "SERVER_KEY";//Server key get in FCM console
$ch = curl_init($pushUrl);
$headers = [];
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization:key=' . $key;
$data = array(
"notification" => array(
"title" => "Bonjour le monde !",
"body" => "Notif de test",
//"click_action" =>"FCM_PLUGIN_ACTIVITY",
"icon" => "fcm_push_icon",
),
"data" => array(
'msg' => 'hello',
'msg2' => 'world'
),
"to" => "MY_IOS_REGISTER_TOKEN"//token get on my ipad with the getToken method of cordova plugin,
"priority" => "high",
);
$json_data = json_encode($data);
curl_setopt($ch,CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
curl_close($ch);
echo "<pre>" . print_r($res,true) . "</pre>"; exit;//{"multicast_id":xxxx,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidApnsCredential"}]}
谢谢你。