1

I used cordova plugin phonegap-plugin-push and I sent a push notification on a test device with development certificate and it works. Instead, when I try with distribution certificate (on the appStore published on store) doesn't work. The token is generated, but the notification doesn't reach device with alert badge or sound. (I exported correctly the certificate in p12 and enabled push notification both on the apple developer and Xcode). Hope someone can helps me. Thank you!

Denise
  • 131
  • 10
  • 1
    Possible duplicate of [iOS Push Notifications not working for Distribution](http://stackoverflow.com/questions/9920587/ios-push-notifications-not-working-for-distribution) – kb920 Jun 07 '16 at 08:30

1 Answers1

1

POSSIBLE ISSUE:

Make you sure to use LIVE gateway URL, i.e. ssl://gateway.push.apple.com:2195 and not sandbox URL.

I will suggest to make a IS_LIVE Flag like below:

if($this->isLive){
                $connection = stream_socket_client(
                'ssl://gateway.push.apple.com:2195', $err,
                $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
            }
            else{
                $connection = stream_socket_client(
                'ssl://gateway.sandbox.push.apple.com:2195', $err,
                $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
            }
gunjot singh
  • 2,578
  • 20
  • 28