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!
Asked
Active
Viewed 388 times
1
-
1Possible 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 Answers
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
-
thank you a lot for your reply! Do you know where exactly set this gateway into the cordova plugin? – Denise Jun 07 '16 at 08:52
-
This has to be in your Server Code, which sends the Push Notification to your iOS device. – gunjot singh Jun 07 '16 at 09:24
-
-
no, in that case, you wouldn't have received any notification in development mode. – gunjot singh Jun 07 '16 at 10:09
-
-
I found the problem, It was an error in the backend code sending push notification. – Denise Aug 01 '16 at 08:26