I created an App to send remote notifications from a web server. When I tested the App in Development Mode all the notifications arrived correctly on the phone, after the AppStore release the app did not receive notifications anymore.
Here it is what I did:
Here it is what i tested:
Here is how I sign the app on Xcode:
Here is the code of the php page to send notifications:
$ctx = stream_context_create(); //stream_context_set_option($ctx, 'ssl', 'passphrase', 'development_pwd'); //stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck_development.pem'); //$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); //test stream_context_set_option($ctx, 'ssl', 'passphrase', 'production_pwd'); stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck_production.pem'); $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); //production echo "<p>Connection Open</p>"; if(!$fp){ echo "<p>Failed to connect!<br />Error Number: " . $err . " <br />Code: " . $errstrn . "</p>"; return; } else { echo "<p>Sending notification!</p>"; } $i = 0; foreach ($deviceToken as $dt) { $dt = str_replace(' ' , '' , $dt); $msg = chr(0) . pack('n',32) . pack('H*', $dt) . pack('n',strlen($payload)) . $payload; echo "<p>" . $i . " - Message sent: " . $payload . "<br />Token: ". $dt . "<br />***" . $msg . "***</p>"; $result = fwrite($fp, $msg, strlen($msg)); $i++; if (!$result) echo '<p>Message not delivered ' . PHP_EOL . '!</p>'; else echo '<p>Message successfully delivered ' . PHP_EOL . '!</p>'; } fclose($fp); echo "<p>Total Notifications Sent: " . $i . "</p>"; echo "<p>Connection Closed!</p>"; } ?>
Conclusions: I have the Test App on my PC that receive APNS Push Notifications. I have the exactly same app released on App Store that not receive APNS Push Notifications.
I realy made everything in my power to fix this issue and read about thousand pages of forums, stackoverflow and Apple Documentations.
I'm willing to retribuite everyone of you who helps me find the solution to my issue!
Settings > Sounds & Vibration > Do Not Disturb: if this setting is enabled, Push Notifications will not be received. Make sure this is disabled. Settings > General > Background App Refresh: this setting allows the app to run in the background and must be turned on.
APNs needs to be used for push messaging when an application is in the background. Hence, FCM uses APNs to deliver messages when the message contains user visible payload, e.g., body, sound etc. FCM also delivers via APNs when content available is set.
One of the main reasons why your phone's notifications aren't working could be due to broken app updates. If your Android device is not getting notifications from one app in particular, it's possible that the developers have accidentally rolled out a buggy update.
The link you mentioned is Sandbox APNS link. Production APNS link is as per Apple documentation is:
You access the production environment at gateway.push.apple.com, outbound TCP port 2195.
Few things to verify:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With