简体   繁体   English

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

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

I'm using: 我正在使用:

Xcode10 Legacy build Xcode10旧版构建

Phonegap-plugin-push 1.10.5 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) 我关注了https://github.com/aggarwalankush/push-notification-server (通知服务器)和https://github.com/aggarwalankush/ionic-push-base (离子应用程序)

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

I have also set up the .p12 certificate for both production and development and have targeted the production certificate in my notification server. 我还为生产和开发设置了.p12证书,并在通知服务器中定位了生产证书。

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: 我还将证书上传到FCM如下:

在此处输入图片说明

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. 其中withSandboxDestination()用于调试目的。

Even if you compiled the app "for release" in xcode , it will be still under "development". 即使您在xcode中将应用程序“发布”编译,它仍处于“开发中”状态。

Once the app is on the app store, you would need to: 一旦应用程序在应用程序商店中,您将需要:

change "withSandboxDestination()" to "withSandboxDestination()"更改为

"withProductionDestination()"

Hope this helps anyone who has the same issue as me. 希望这对与我有相同问题的任何人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在开发和生产模式下,推送通知如何工作,(pushwoosh) - How does Push Notifications work while in development and production mode, (pushwoosh) Ionic的Ionic框架-开发模式 - Ionic Framework for ios - Development Mode iOS In-App购买适用于开发但不适用于生产 - iOS In-App purchase works in development but not in production react-native-sound 在 iOS 的生产版本中不起作用,但在模拟器和生产 android 中工作 - react-native-sound does not work in production build for iOS but works within emulator and for production android iOS 10设备,未在生产模式下接收通知,但开发正常 - iOS 10 device , not receiving notification in production mode, but development is working Ionic 2 Storage在iOS上不起作用 - Ionic 2 Storage does not work on iOS fcm onMessage 在模拟器上工作,但在物理设备上不起作用 - fcm onMessage works on simulator but does not work in physical device 离子获取 ios 的设备信息不起作用,而相同的代码适用于 Android - ionic getting device information for ios does not work while same code works for Android Ionic 3 IOS App不适用于首次启动,但在强行杀死并启动后才能运行 - Ionic 3 IOS App does not work for first launch, but works after force kill and launch Xcode - 条件开发或生产模式 - Xcode - conditional development or production mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM