Push notifications delivered to apple apns server but device received nothing

旧时模样 提交于 2019-12-13 12:27:22

问题


Development environment:

iOS 9.3.2 (iPh6ne 6+) ... but it works on iOS 8.x

Phonegap 6.2.7

Phonegap-plugin-push v1.7.2

PHP7 (server side)- contentpush - ref

My situation:

  1. the token was delivered to my server automatically

  2. message sent to ssl://gateway.push.apple.com 2195 successfully

  3. nothing received in device even alert("")

    push.on('notification', function(data) { console.log(data.message); alert(""); alert(data.title+" Message: " +data.message); });


回答1:


Apple doesn't give any guarantee on successful message delivery. you can see related answer here

If you're not seeing Apple push notifications when you're connected to a network, check with your network administrator to make sure related TCP ports are accessible.

To use Apple Push Notification service (APNs), your Mac and iOS clients need a direct and persistent connection to Apple's servers.

iOS devices try to connect to APNs using cellular data first. If the device can't connect to Apple's servers over the cellular connection, it then tries to connect using Wi-Fi.

If you use Wi-Fi behind a firewall or a private Access Point Name (APN) for cellular data, you'll need a direct, unproxied connection to the APNs servers on these ports:

TCP port 5223: For communicating with Apple Push Notification services (APNs)
TCP port 2195: For sending notifications to APNs
TCP port 2196: For the APNs feedback service
TCP port 443: For a fallback on Wi-Fi only, when devices can't reach APNs on port 5223

The APNs servers use load balancing, so your devices won't always connect to the same public IP address for notifications. It's best to allow access to these ports on the entire 17.0.0.0/8 address block, which is assigned to Apple.

APNs stands for the Apple Push Notification service. APN stands for Access Point Name, the gateway between a cellular data network and the Internet.

check this link for same explanation

and also check for How do I troubleshoot issues with Push Notifications on iOS?




回答2:


Thx all. I found out the problem now. I would like to share my experience in developing apns apps.

Server-side

Make sure

  1. to create your pem file correctly (production)

  2. to enter your passphase correctly

  3. the url should be ssl://gateway.sandbox.push.apple.com 2195 before your app being uploaded to App Store. (This is my problem)

App-side

  1. Make sure you have switch on the push notification button and background notification in Xcode

  2. Enable bitcode should be "No" in Xcode7.



来源:https://stackoverflow.com/questions/38090059/push-notifications-delivered-to-apple-apns-server-but-device-received-nothing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!