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

若如初见. 提交于 2019-12-24 19:28:51

问题


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:


回答1:


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.



来源:https://stackoverflow.com/questions/53864253/ionic-ios-fcm-works-in-development-mode-but-does-not-work-in-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!