简体   繁体   中英

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:

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM