iOS: Push Notifications have stopped working

2019-08-05 06:56发布

问题:

Push notifications have stopped working for the production version of our iOS app. It's been about a year since we released our app, so I'm guessing it's an issue with the certificate expiring. First of all, is there any way to verify that this is in fact the problem?

I tried to go to the Apple Developer site, generate a new production APNS certificate with the appropriate App ID, download the certificate, add to keychain, export the key for that certificate, and add replace the existing key on our server. This did not seem to work. Does anything about that process seem off? Is there somewhere I can find detailed steps for solving this problem?

EDIT: I'm using JavaPNS to send the notifications, and it reports that they are being sent successfully, but they are not showing up on the devices.

EDIT #2: I see this in the docs for JavaPNS.

Important: you will not get any error if you try to push a notification through an APNS server that does not match your certificate (sandbox or production), either server-side or application-side, but your notification will never make it to your mobile application. You must be very careful that the certificate provided to JavaPNS matches the one currently built into your mobile application, and that it matches the APNS server you are choosing to use (sandbox or production). Any failure to match these three will result in missing notifications.

"You must be very careful that the certificate provided to JavaPNS matches the one currently built into your mobile application,"

What does it mean by "matches"? Just the AppID?

回答1:

The Apple Push Notification Service (APNS) certificate, lasts for one year and must be renewed annually. You can create a new certificate or renew your older certificate.

It is maybe not immediate, wait a little to see if it worked.



回答2:

If all else fails...

My iOS7 developer application stopped receiving messages after changing Provisioning Profiles.

Try going into SETTINGS->NOTIFICATION CENTER, scroll down to your app, tap it and toggle your Alert style between NONE and the style you want.

As soon as I did that I got a notification. Maybe this might help someone save as many hours as I lost o_O