title: Phonegap push notification plugin with iOs
body: <p>I'm using phonegap-plugin-push to send push notifications to Android devices.</p>
  
  <p>I'm trying to figure out how to send notification to iOs.</p>
  
  <p>I've registered at <a href="https://developers.google.com/mobile/add?platform=ios&amp;cntapi=gcm&amp;cnturl=https:%2F%2Fdevelopers.google.com%2Fcloud-messaging%2Fios%2Fclient&amp;cntlbl=Continue%20Adding%20GCM%20Support&amp;%3Fconfigured%3Dtrue" rel="nofollow noreferrer">https://developers.google.com/mobile/add?platform=ios&amp;cntapi=gcm&amp;cnturl=https:%2F%2Fdevelopers.google.com%2Fcloud-messaging%2Fios%2Fclient&amp;cntlbl=Continue%20Adding%20GCM%20Support&amp;%3Fconfigured%3Dtrue</a></p>
  
  <p>I'get token at client app same way as in Android:</p>
  
  <pre><code>var push = PushNotification.init({
          android: {
              senderID: "5993...475"
          },
          ios: {
              alert: "true",
              badge: true,
              sound: 'false'
          },
          windows: {}
      });
  
  push.on('registration', function(data) {
  
      $.ajax({
          url: '/save-token/',
          data: {token: data.registrationId},
          success: function (json) {
  
          }
      });
  
  
  });
  </code></pre>
  
  <p>After I get client's token, I try to send'em push notification:</p>
  
  <pre><code>$to = ModelGcmTokens::getInstance()-&gt;getToken($userId);
  
  $API_KEY = 'AIzaS...HcEYC346zQ';
  
  
          $message = array(
              'data' =&gt; array(
                  'title' =&gt; ($title) ? $title : 'Test!',
                  'message' =&gt; $message
              ),
              'to' =&gt; $to
          );
  
          $message = json_encode($message);
  
          $ch = curl_init();
  
          curl_setopt($ch, CURLOPT_URL,"https://gcm-http.googleapis.com/gcm/send");
          curl_setopt($ch, CURLOPT_POST, 1);
          curl_setopt($ch, CURLOPT_POSTFIELDS, $message);
  
  
          curl_setopt($ch, CURLOPT_HTTPHEADER, array(
              "Authorization:key={$API_KEY}",
              "Content-Type:application/json",
          ));
  
          // receive server response ...
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  
          $server_output = curl_exec ($ch);
  
          curl_close ($ch);
  
          // further processing ....
          if ($server_output == "OK") {
  
              return true;
          } else {
  
              return false;
          }
  </code></pre>
  
  <p>Google cloud messaging responds with <strong>InvalidRegistration</strong> error:</p>
  
  <pre><code>{"multicast_id":4701637331500989392,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
  </code></pre>
  
  <p>As I googled this error - it's said that I got client's token wrong.
  But I get it with excat same script as on Android. And it works on Android.</p>
  
  <p>The only difference, that I see - is format of the token:</p>
  
  <p><a href="https://i.stack.imgur.com/9J8hd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9J8hd.png" alt="enter image description here"></a></p>
  
  <p>Can anyone tell me how do I get push plugin working on iOs? What's wrong with iOs token and how do I supposed to send messages to GCM, to be received by iOs?</p>
  
  <p>Thanks a lot in advance for any advice. I'm really stuck.</p>