APNs A message is sent to the server; notification is not received on the iOS device

I configured apns_certificate.pem and apns_privatekey.pem for the server. I am using node.js server to send push notifications. I successfully sent a notification to the apns server, but the device did not receive any push notification.

I also went through Push Notifications troubleshooting . I checked all the pem files by running a command on the server side as described in the troubleshooting document.

$ openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert YourSSLCertAndPrivateKey.pem -debug -showcerts -CAfile server-ca-cert.pem 

It was a success.

I checked that my server was able to connect to the apns server with the following commands.

 $ telnet 1-courier.push.apple.com 5223 $ telnet gateway.sandbox.push.apple.com 2195 $ telnet gateway.push.apple.com 2195 

I set it up correctly in the iOS project, and I also get a token.

But still, I did not receive push notifications on my device.

+5
source share
1 answer

Please check the device token or not. For which the device token sends push notifications. Also, a push notification should check the background mode of the application.

If all of the above is correct, you will receive a push notification.

Also check these two methods in the application deletion and send the device token from the iOS application to the server:

  - (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { NSString *str = [NSString stringWithFormat:@"Device Token=%@",deviceToken]; str = [str stringByReplacingOccurrencesOfString:@" " withString:@""]; NSLog(@"This is device token%@", str); } - (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err { NSString *str = [NSString stringWithFormat: @"Error: %@", err]; NSLog(@"Error %@",err); } 
-2
source

All Articles