xcode 适用于 iOS 的 Google Firebase 推送通知在生产环境中不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39034380/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:09:29  来源:igfitidea点击:

Google Firebase Push Notifications for iOS are not working in production environment

iosxcodefirebaseapple-push-notificationsfirebase-cloud-messaging

提问by sleepwalkerfx

I'm using Google Firebase Cloud Messaging API (FCM) to send push notifications to my iOS app. I could get push-notifications working successfully when I test the app on a device with Development provisioning profiles + development push notification(sandbox) certificates.

我正在使用 Google Firebase Cloud Messaging API (FCM) 向我的 iOS 应用发送推送通知。 当我在具有开发配置文件 + 开发推送通知(沙盒)证书的设备上测试应用程序时,我可以成功获得推送通知。

However I'm unable to get it working on production environment. I made an ad-hoc build with correct production provisioning profiles and production push notification certificates. And synced an IPA file to a device via iTunes for testing (not directly from xcode). Still I can't receive push notifications from firebase console.

但是我无法让它在生产环境中工作。我使用正确的生产配置文件和生产推送通知证书进行了临时构建。并通过 iTunes 将 IPA 文件同步到设备进行测试(不是直接来自 xcode)。我仍然无法从 firebase 控制台接收推送通知。

I have uploaded correct development and production certificates (with private keys) to firebase as well. I've double checked every possible step that could go wrong but, still can't find the issue. Is there a way to troubleshoot this issue? Or isn't it possible to get production environment notifications to an AdHoc build?

我也将正确的开发和生产证书(带有私钥)上传到了 firebase。我已经仔细检查了每一个可能出错的步骤,但仍然找不到问题。有没有办法解决这个问题?或者无法将生产环境通知发送到 AdHoc 构建?

回答by andrew_b

I had the same issue. Apparently there is an error in the Firebase documentation. When you exporting the APN certificate for production from your keychain to the .p12 file you have to select the actual certificate, not the private key.

我遇到过同样的问题。显然 Firebase 文档中有错误。当您将用于生产的 APN 证书从钥匙串导出到 .p12 文件时,您必须选择实际证书,而不是私钥。

Make sure you upload to the Firebase console this .p12 file in the Cloud Messaging APN certificate settings.

确保在 Cloud Messaging APN 证书设置中将此 .p12 文件上传到 Firebase 控制台。

回答by hyd00

Had same issue. Finally got it working by:

有同样的问题。终于让它工作了:

  1. Using the correct Projectand TargetBuild Settings as mentioned in Thislink.

  2. And revoking the existing push certificates and creating a new one completely, and then uploading the new certificate's .p12file to the Firebase Console.

  1. 使用链接中提到的正确ProjectTarget构建设置。

  2. 并撤销现有的推送证书并完全创建一个新证书,然后将新证书的.p12文件上传到 Firebase 控制台。

回答by damjandd

What fixed my issue was using the new Authentication Keys method instead of the old p12 files. You can read more in the Firebase documentation, just follow their steps and you should be fine.

解决我的问题的是使用新的身份验证密钥方法而不是旧的 p12 文件。您可以在 Firebase 文档中阅读更多内容,只需按照他们的步骤操作即可。

回答by Anna Kaz

I had the same issue.

我遇到过同样的问题。

What helped me: adding APNS for Distribution Certificate to Firebase. Simple as that ;)

对我有什么帮助:将 APNS for Distribution Certificate 添加到 Firebase。就那么简单 ;)

回答by xhinoda

Finally work for me...

终于对我来说有效了...

Here my steps:

这是我的步骤:

1 - Make sure to Enable FirebaseAppDelegateProxyEnabled to YES in the info.plist

1 - 确保在 info.plist 中启用 FirebaseAppDelegateProxyEnabled 为 YES

2- Revoke your certificate (APNS develop and distribution) and create a news ones

2-撤销您的证书(APNS开发和分发)并创建一个新闻

3 - NOTE: there is an error in the Firebase documentation. When you exporting the APN certificate for production from your keychain to the .p12 file you have to select the actual certificate, not the private key.

3 - 注意:Firebase 文档中有错误。当您将用于生产的 APN 证书从钥匙串导出到 .p12 文件时,您必须选择实际证书,而不是私钥。

4 - Make sure you upload to the Firebase console this .p12 file in the Cloud Messaging APN certificate settings.

4 - 确保在 Cloud Messaging APN 证书设置中将此 .p12 文件上传到 Firebase 控制台。

5- Send remote notification with Firebase Console.

5- 使用 Firebase 控制台发送远程通知。

Thanks to all..!

谢谢大家..!