arnesson / cordova-plugin-firebase

Cordova plugin for Google Firebase
http://arnesson.github.io/cordova-plugin-firebase
MIT License
1k stars 1.55k forks source link

Receiving notifications on iOS 9 but not iOS 10 #420

Closed bellsaladin closed 6 years ago

bellsaladin commented 6 years ago

Hello, I'm facing a problem with notifications, i'm a not a able to receive notifications only on iOS 10. XCode returns the following error when i run the app on iOS 10 device :

<Error> [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure] to your application initialization.

Did anyone solve this issue ? Thanks.

sebastian312 commented 6 years ago

I receive the same error on iOS 10( 10.3.3) . in iOS 9 and Android devices everything works fine. There's also no difference when using the plugin version 0.1.22, 0.1.23 or 0.1.24

mathieu21 commented 6 years ago

I experience the same and still cannot find a solution to it.

jskidd3 commented 6 years ago

Any luck finding a solution to this?

kirajhpang commented 6 years ago

I also facing similar issue with this. OS version 9.3 can receive, but 10.3 no receive and capture this in error log

2017-09-11 15:47:15.920352+0800 xxx[4891:1857825] [Firebase/Messaging][I-FCM002019] FIRMessaging received data-message, but FIRMessagingDelegate's-messaging:didReceiveMessage: not implemented
2017-09-11 15:47:15.921 xxx[4891] <Warning> [Firebase/Messaging][I-FCM002019] FIRMessaging received data-message, but FIRMessagingDelegate's-messaging:didReceiveMessage: not implemented
2017-09-11 15:48:14.309268+0800 xxx[4891:1857603] Unable to connect to FCM. Error Domain=com.google.fcm Code=2001 "FIRMessaging is already connected" UserInfo={NSLocalizedFailureReason=FIRMessaging is already connected}
jjosef commented 6 years ago

Any possibility upgrading to SDK 4.1.1 will help? Anyone tried this? If not I will give it a go.

bellsaladin commented 6 years ago

This issue might be caused by xCode i was using xCode 7. Now i use xCode 8 and my application can receive notifications on iOS 10+. Please confirm it if this solves your problem.

sebastian312 commented 6 years ago

I use xCode 8.3.3 and still can't receive notifications on iOS 10.*

bellsaladin commented 6 years ago

I use cordova-plugin-firebase v0.1.22. Check if you use 0.1.24 it's known to be not compatible with iOS 10 yet.

kirajhpang commented 6 years ago

@jjosef you mean which SDK? ionic-iOS?

@bellsaladin I was use xCode 8 and no notification receive, I was suspect is because the connection from FCM to ASP take time to configure. But at the end, I was turn down this plugin and go for paid service, work well for me now so all platform.

bellsaladin commented 6 years ago

@kirajhpang jjosef suggested to change the Firebase SDK to 4.1.1. All i did for notifications to work on iOS 10 was switching back to cordova-plugin-firebase v0.1.22 and using xCode v8 instead of v7.

wo-github commented 6 years ago

@bellsaladin I have the same problem. On iOS 9 it works and I receive the message in window.FirebasePlugin.onNotificationOpen() function. On iOS 10 this function isn`t called and nothing happens. Xcode Version is 8.3.3 plugin verison is now 0.1.22 The message is send via firebase console to one device.

bellsaladin commented 6 years ago

@wo-github i only tried notification while app is closed or in background so window.FirebasePlugin.onNotificationOpen() is not being used in this case. Didn't try foreground notifications yet.

wo-github commented 6 years ago

I make a update of cordova to 7.0 and update ios to 4.4 I receive now the data, if the app is open in the window.FirebasePlugin.onNotificationOpen() function. The next problem is, I receive nothing, if the app is in background. Does someone has an idea what could be the problem?

wo-github commented 6 years ago

I analyze the behavior with Xcode. If I open the app the console shows: Connected to FCM. InstanceID token: ##########

And if I close the app to background, the console shows: Disconnected from FCM

Could this be the problem? How could the app receive messages in backgroundmode?

gioramies commented 6 years ago

@wo-github I'm having the same issue. Console logs "Disconnected from FCM" when app goes to background. Please help.

ourarash commented 6 years ago

Any luck with solving this issue? I also get this message and notifications don't work:

[Firebase/Messaging][I-FCM002019] FIRMessaging received data-message, but FIRMessagingDelegate's-messaging:didReceiveMessage: not implemented

suresh-selvaraj commented 6 years ago

Is this issue solved?

bellsaladin commented 6 years ago

@suresh-selvaraj @ourarash @gioramies @wo-github @sebastian312 @jjosef @jskidd3 @kirajhpang I had the same problem and to solve i did the following :

These changes are required to fix a known issue with iOS related to Apple's ATS (App Transport Security). Check the links below for more details. I hope this helps.

Sources : https://developers.google.com/admob/ios/app-transport-security (Admob iOS10 problem & ATS) https://www.techrepublic.com/article/how-to-migrate-to-https-using-app-transport-security-when-developing-ios-apps/

gioramies commented 6 years ago

Thank you @bellsaladin

I only tested my problem on iOS 9. It was that the notification didn't arrive when the app was in background. To fix it I followed the Google FCM documentation: https://firebase.google.com/docs/cloud-messaging/ios/certs and now it works (only tested on iOS9)

robertarnesson commented 6 years ago

closing for now, reopen if still an issue with the latest version of the plugin