0

Ich versuche Push-Benachrichtigungen an meine Cordova Ios App zu senden.Push-Benachrichtigung mit FCM an IOS senden

Ich benutze das Plugin cordova-plugin-fcm

Für meinen Android-App ist es perfekt funktioniert, ist das Problem für Ios, meine curl Anfrage Rückkehr:

InvalidApnsCredential

Ich habe meinen APNs laden Schlüssel auf FCM und dieser Schlüssel funktioniert, weil ich versuche, eine Push-Benachrichtigung mit nur Apns zu senden und es funktioniert gut meine App erhalten die Benachrichtigung.

Hier wird das APNS Skript, die arbeiten: http://thrysoee.dk/apns/

Hier meine php curl Script mit FCM Wich Arbeit mit Android aber nicht Ios:

$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"}]} 

Vielen Dank.

Antwort

0

Nun endlich finde ich das Problem. Verwenden Sie auf der Firebase-Konsole immer Ihre Apple TeamID für das App-Präfix, auch wenn Ihre AppID eine PräfixID hat, die von Ihrer TeamID

abweicht
Verwandte Themen