简体   繁体   English

iOS无法在Cordova项目(2018)上收到来自FCM的推送通知

[英]iOS cannot receive push notification from FCM on Cordova project (2018)

I've been few days stuck with this problem (again!). 我几天都遇到了这个问题(再一次!)。 FCM push notification works fine on Android and on my current live/prd version of the app (still running and working well). FCM推送通知在Android和我当前的live / prd版本的应用程序上运行正常(仍在运行且运行良好)。 But recently I upgraded to Cordova 7.1.0 , platform iOS 4.4.0 and re-add all the plugins for my next update of the app. 但最近我升级到Cordova 7.1.0平台iOS 4.4.0并重新添加所有插件,以便我下次更新应用程序。

Everything works well except this FCM on iOS!!!! 一切都运行良好,除了iOS上的FCM! Not working for all version and all iOS devices. 不适用于所有版本和所有iOS设备。 I had this problem before, but it was an easy fix (missing GoogleService-Info.plist file on FCM plugin). 我之前遇到过这个问题,但这是一个简单的修复(在FCM插件上缺少GoogleService-Info.plist文件)。 But currently this problem appeared again and I really have no idea how to fix it. 但目前这个问题再次出现,我真的不知道如何解决它。 Been going through lots of questions and tried lots of things. 经历了很多问题并尝试了很多东西。

Steps that I have done: 我已经完成的步骤:

  1. Remove and re-add FCM plugin as well as platform iOS 删除并重新添加FCM插件以及平台iOS
  2. Check and make sure the file not empty for GoogleService-Info.plist files on: Cordova-plugin-fcm > src > ios; 检查并确保文件在GoogleService-Info.plist文件中不为空:Cordova-plugin-fcm> src> ios; platform > ios > [myproject] > resources; platform> ios> [myproject]>资源; platform > ios > [myproject] > resources > resources platform> ios> [myproject]> resources> resources
  3. Test sending push notifications from firebase console. 测试从firebase控制台发送推送通知。 It says completed and sent! 它说完成并发送! but not receiving on iOS (received on Android) 但没有在iOS上接收(在Android上收到)
  4. Turn on and off and on again in Xcode capabilities: push notifications, as well as background modes > remote notifications, and keychain sharing 在Xcode功能中打开和关闭再打开:推送通知,以及后台模式>远程通知和钥匙串共享
  5. Check [myproject].entitlements > APS with value Development is there 检查[myproject] .entitlements> APS的价值发展是否存在
  6. Add FirebaseAppDelegateProxyEnabled value NO on info.plist 在info.plist上添加FirebaseAppDelegateProxyEnabled值NO
  7. Check the validity of my APNS key and certificate through: openssl s_client -connect gateway.push.apple.com:2195 -cert pushtry.pem -key pushtry.pem and return verify code 0(OK) at the end 通过以下方式检查我的APNS密钥和证书的有效性: openssl s_client -connect gateway.push.apple.com:2195 -cert pushtry.pem -key pushtry.pem并在最后返回验证码0(OK)
  8. Trying to test APNS on http://pushtry.com but said Arvind APNS Connection Failed: 0 as result. 试图在http://pushtry.com上测试APNS但是说Arvind APNS连接失败:结果为0 When I try to send FCM push from the same website, it is sent successfully (received on Android, not on iOS) Anyone know how to run this properly and what is the result should be? 当我尝试从同一个网站发送FCM推送时,它会成功发送(在Android上收到,而不是在iOS上)任何人都知道如何正确运行这个,结果应该是什么?
  9. Check all the provisioning profiles and certificates and make sure they are not expired yet. 检查所有配置文件和证书,确保它们尚未过期。 And I do have the Apple Push Service for both development and production. 我确实有Apple推送服务用于开发和生产。
  10. Double check the bundle ID and APP ID to match with the Firebase console settings. 仔细检查捆绑包ID和APP ID以与Firebase控制台设置匹配。

I run the app from Xcode 10 with multiple iPhone ranging from iOS 11 to 12. All cannot receive the push notifications. 我使用从iOS 11到12的多个iPhone从Xcode 10运行应用程序。所有都无法接收推送通知。 But when I download my app from play store, it is still receiving push notification. 但是当我从Play商店下载我的应用程序时,它仍然会收到推送通知。 the FCM plugin version is cordova-plugin-fcm 2.1.2 . FCM插件版本是cordova-plugin-fcm 2.1.2

Please help! 请帮忙! What should I do and check beside all of those mentioned above? 我应该怎么办,并检查上面提到的所有这些? I need to update the app soon. 我需要尽快更新应用程序。 But I am scared after the update, all the live version with the newly updated app will not be receiving push notifications, which is very crucial for our app! 但是在更新后我很害怕,所有带有新更新应用程序的实时版本都不会收到推送通知,这对我们的应用来说非常重要!

I am suspecting the mismatch of the provisioning profile with code signing identity, but I have never changed them for 1 year+ already (only update and recreate the certificate once it is expired). 我怀疑配置文件与代码签名标识不匹配,但我从未更改它们1年+已经(只有更新并在证书过期后重新创建)。 I do not think it is the problem from FCM because it sent out the push notification and no problem on android. 我不认为这是来自FCM的问题,因为它发送了推送通知,并且在android上没有问题。 But then again, the last update of my app was two months ago. 但话说回来,我的应用程序的最后一次更新是在两个月前。 After that I rarely check on iPhone (especially push notification) because I don't have one. 之后我很少检查iPhone(特别是推送通知),因为我没有。 Always doing my dev with Android phone. 一直用Android手机做我的开发。 So maybe I missed out something? 也许我错过了一些东西? Advice and solution, please? 建议和解决方案,好吗?

All version of my app on my development (my local MAC) is not working now. 我开发的所有版本的应用程序(我的本地MAC)现在都无法运行。 Even if I try to build and run the older version of my app. 即使我尝试构建并运行我的应用程序的旧版本。 The push notifications are not being received. 未收到推送通知。 So maybe my cordova or iOS problem. 也许我的cordova或iOS问题。

I had the same problem and solved it by changing XCode build system: 我遇到了同样的问题并通过更改XCode构建系统解决了这个问题:

XCODE file > Project Settings > (use Legacy Build system instead of New Build system.) XCODE文件>项目设置>(使用旧版构建系统而不是新构建系统。)

Also remove FirebaseAppDelegateProxyEnabled from info.plist 还要从info.plist中删除FirebaseAppDelegateProxyEnabled

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

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