iospush-notificationapple-push-notificationsfirebase-cloud-messagingcordova-plugin-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). 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.

Everything works well except this FCM on iOS!!!! Not working for all version and all iOS devices. I had this problem before, but it was an easy fix (missing GoogleService-Info.plist file on FCM plugin). 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
  2. Check and make sure the file not empty for GoogleService-Info.plist files on: Cordova-plugin-fcm > src > ios; platform > ios > [myproject] > resources; platform > ios > [myproject] > resources > resources
  3. Test sending push notifications from firebase console. It says completed and sent! but not receiving on iOS (received on Android)
  4. Turn on and off and on again in Xcode capabilities: push notifications, as well as background modes > remote notifications, and keychain sharing
  5. Check [myproject].entitlements > APS with value Development is there
  6. Add FirebaseAppDelegateProxyEnabled value NO on info.plist
  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
  8. Trying to test APNS on http://pushtry.com but said Arvind APNS Connection Failed: 0 as result. 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?
  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.
  10. Double check the bundle ID and APP ID to match with the Firebase console settings.

I run the app from Xcode 10 with multiple iPhone ranging from iOS 11 to 12. All cannot receive the push notifications. But when I download my app from play store, it is still receiving push notification. the FCM plugin version is 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). I do not think it is the problem from FCM because it sent out the push notification and no problem on 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. Always doing my dev with Android phone. 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. 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.


Solution

  • I had the same problem and solved it by changing XCode build system:

    XCODE file > Project Settings > (use Legacy Build system instead of New Build system.)

    Also remove FirebaseAppDelegateProxyEnabled from info.plist