Search code examples
iosswiftpush-notificationapn

Push notifications stop working after packaging iOS app


I have an enterprise iOS app I'm developing which receives push notifications for various features. I have the push notification service installed and working while debugging the app with Xcode and an iPhone X (phone doesn't matter, I've tried multiple and they all seem to work directly from Xcode).

If I package the app and distribute it over the air to the device, I get the normal "Would you like to receive push notifications" (which I agree to), but then it won't receive push notifications.

Things I've checked:

  • Make sure the device capability "Push Notifications" is turned on.
  • Make sure the bundle identifier matches.
  • Verify that the pushID is correct.
  • Verify that Background Modes: Remote Notifications is turned on.

The only thing I can think of is that maybe when the app is packaged it's flipping something to production rather than development and maybe when I send the push notification it's not able to send to production or something along those lines.

Has anyone had this issue before?


Solution

  • @HarshalBhavsar's answer got me closer. I found the explanation here though: https://stackoverflow.com/a/35628480/3921182

    As it turns out, Apple has a push notification service for development that is separate from distribution(production). When sending the push notification messages to a distributed app, they actually need to be sent to:

    ssl://gateway.push.apple.com:2195 rather than ssl://gateway.sandbox.push.apple.com:2195