ionic iOS FCM在开发模式下工作,但在生产中不工作

ionic iOS FCM在开发模式下工作,但在生产中不工作

问题描述:

我正在使用:

Xcode10旧版构建

Xcode10 Legacy build

Phonegap-plugin-push 1.10.5

Phonegap-plugin-push 1.10.5

我关注了 https://github.com/aggarwalankush/push-notification-server(通知服务器)和 https://github.com/aggarwalankush/ionic-push-base (离子应用程序)

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

我已经使用 https://设置了FCM medium.com/@ankushaggarwal/gcm-setup-for-android-push-notifications-656cfdd8adbd .

我还为生产和开发设置了.p12证书,并在通知服务器中定位了生产证书.

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?

我还按如下方式将证书上传到FCM:

I have also upload the certificate into FCM as follows:

我终于弄清楚了这个问题.

I have finally figured out the issue.

这是由于:

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

其中withSandboxDestination()用于调试目的.

where withSandboxDestination() is for debugging purposes.

即使您在xcode中将应用编译为发布",它仍将处于开发"状态.

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:

"withSandboxDestination()"更改为

"withProductionDestination()"

希望这对与我有相同问题的人有所帮助.

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