Gene
Gene

Reputation: 2218

ionic iOS FCM works in development mode but does not work in production

I'm using:

Xcode10 Legacy build

Phonegap-plugin-push 1.10.5

I followed https://github.com/aggarwalankush/push-notification-server (notification server) and https://github.com/aggarwalankush/ionic-push-base (ionic app)

I have set up FCM using https://medium.com/@ankushaggarwal/gcm-setup-for-android-push-notifications-656cfdd8adbd.

I have also set up the .p12 certificate for both production and development and have targeted the production certificate in my notification server.

Once my app was published to the app-store, the push notification broke. But development build is still working fine. What could be the reason?

I have also upload the certificate into FCM as follows:

enter image description here

Upvotes: 0

Views: 802

Answers (1)

Gene
Gene

Reputation: 2218

I have finally figured out the issue.

It is due to :

ApnsService service =
  APNS.newService()
  .withCert(PATH_TO_P12_CERT, CERT_PASSWORD)
  .withSandboxDestination()
  .build();

where withSandboxDestination() is for debugging purposes.

Even if you compiled the app "for release" in xcode , it will be still under "development".

Once the app is on the app store, you would need to:

change "withSandboxDestination()" to

"withProductionDestination()"

Hope this helps anyone who has the same issue as me.

Upvotes: 1

Related Questions