iOS push notifications stopped? APNs certificates and tokens
Short answer: When iOS push notifications suddenly stop for everyone, the cause is usually on your server's connection to Apple Push Notification service (APNs), not on users' phones. The usual culprits are an expired provider certificate (they're valid for a year), a provider token that's too old or signed with the wrong key, a revoked key, or notifications sent to the wrong APNs environment. Read the error code APNs returns, because it tells you which one you're dealing with, then fix the credential and set a reminder so it doesn't happen again.
First, confirm it's a server-side problem
If one customer says they don't get notifications, it's probably their settings: notifications switched off for your app, Focus modes, or an app that hasn't been opened since a reinstall. If every customer stops receiving order updates, appointment reminders or delivery alerts on the same day, look at the sending side.
Check your server or push provider logs for the HTTP status and reason APNs returned. Apple documents these responses in its "Handling notification responses from APNs" guide. A request that succeeds gets a 200; anything else comes with a reason string, and that string is your diagnosis.
If you use a third-party push service, the same reasons usually appear in its delivery logs or dashboard, sometimes wrapped in the provider's own wording.
The two ways servers authenticate with APNs
Your server proves it's allowed to send notifications for your app in one of two ways.
Certificate-based. You create an Apple Push Notification service SSL certificate for your app's bundle ID in your developer account and install it on your server. Apple's documentation is explicit that provider certificates are valid for a year and must be updated to keep communicating with APNs. This is the classic "it worked for a year, then stopped" failure.
Token-based. You create an APNs authentication token signing key in your developer account. It's a text file with a .p8 extension, identified by a key ID. Your server uses it to sign a short JSON Web Token that includes your 10-character Team ID and an issued-at time. APNs supports only the ES256 algorithm for these tokens. One key can sign tokens for all your apps, and the key itself doesn't carry the yearly certificate renewal, but the tokens it signs must be refreshed regularly.
Reading the error codes
These are the reasons from Apple's response table that most often explain a sudden outage.
| Status and reason | What it means | Usual fix |
|---|---|---|
403 ExpiredProviderToken |
The token's issued-at time is more than one hour old | Refresh tokens on a schedule |
403 InvalidProviderToken |
The token isn't valid or its signature can't be verified | Check key ID, Team ID and the .p8 file |
429 TooManyProviderTokenUpdates |
The token is being updated too often | Cache and reuse the token |
400 BadDeviceToken |
The device token is invalid | Check the environment (see below) |
400 DeviceTokenNotForTopic |
The token doesn't match the topic | Check apns-topic matches the bundle ID |
410 Unregistered |
The token is no longer active for the topic | Stop sending to that token |
Certificate problems often show up as connection or TLS errors before any APNs reason is returned, so a failed handshake in your logs points to the certificate.
Fix by cause
Expired certificate. Create a new push certificate for the same bundle ID in your developer account, export it in the format your server or push provider expects, and replace the old one. Do it before the expiry date next time: put the date in a shared calendar with a reminder a month ahead, and name an owner. Better still, consider moving to token-based authentication, which removes the yearly renewal.
Token too old or too new. Apple asks you to refresh your token no more than once every 20 minutes and no less than once every 60 minutes, and it rejects tokens with a timestamp more than one hour old. A server that generates the token once at start-up and never again will work for an hour and then fail. A server that creates a fresh token for every notification can trip the "too many updates" limit. Cache the token, and regenerate it on a timer, for example every 30 to 50 minutes.
Wrong key details. Check that the key ID in the token header matches the key you're using, that the Team ID is the one your app belongs to, and that the .p8 file wasn't altered by copying it through a system that changed line breaks. If a developer who left the company revoked a key, or someone revoked it after suspecting it was compromised, which Apple recommends in that situation, you'll need a new key and a configuration update everywhere it's used.
Wrong environment. APNs has a development server, api.sandbox.push.apple.com, and a production server, api.push.apple.com. Apple says to use production for shipping apps and development for testing. Device tokens from App Store or TestFlight builds belong to production; tokens from builds run directly from Xcode belong to development. Sending a production token to the sandbox, or the reverse, gets you BadDeviceToken.
Topic mismatch. The apns-topic header is usually your app's bundle ID. If you rename the bundle ID, ship a second app, or copy configuration between apps, notifications fail with DeviceTokenNotForTopic.
Clean up tokens while you're there
A 410 Unregistered response isn't an outage. It means the user deleted the app or the token became inactive, and Apple says there's no need to keep sending to it. Remove those tokens from your database. Keeping them makes your logs noisy and hides real failures.
Preventing the next outage
- Monitor delivery, not just sending. Alert when the share of non-200 responses jumps, not only when your code throws an exception.
- Store credentials in your secrets manager, with the key ID, Team ID and, for certificates, the expiry date recorded beside them.
- Document which environment each server uses, especially staging servers that also send to real test devices.
A worked example
A hypothetical Austin home-services company sends "your technician is on the way" alerts from its own server. One morning, no alerts arrive. The logs show 403 ExpiredProviderToken on every request since 10 a.m. A deployment at 9 a.m. had replaced the token cache with code that built a token once at start-up. The team restores a timer that regenerates the token every 40 minutes, alerts resume, and they add a monitor that pages someone if APNs errors pass a threshold.
FAQ
Do I need separate credentials for development and production?
With tokens, one signing key works for both servers; you just send to the right address. Certificates are created per app, and Apple's certificate type covers sandbox and production.
Can I use one key for several apps?
Yes. A token signing key belongs to your developer team, so one key can sign tokens for each of your apps, with the topic header naming the app.
Will users need to update the app after I fix this?
Not for a credential problem. The fix is on your server, and notifications resume for existing installs.
Does Android work the same way?
No. Android uses Firebase Cloud Messaging with its own credentials and errors, so check those separately.
If your app's notifications have gone quiet and you'd like a second pair of eyes on the sending setup, tell us what your logs show.
Sources
- https://developer.apple.com/documentation/usernotifications/establishing-a-token-based-connection-to-apns
- https://developer.apple.com/documentation/usernotifications/establishing-a-certificate-based-connection-to-apns
- https://developer.apple.com/documentation/usernotifications/handling-notification-responses-from-apns
- https://developer.apple.com/documentation/usernotifications/sending-notification-requests-to-apns