-
-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS ERROR with getToken "Error Domain=com.google.fcm Code=0 "Invalid fetch response, ..." #791
Comments
It seems that there was a release like the following on the FCM side. |
Since this change was released in v10.4.0 of the Firebase iOS SDK, so long as you use v10.3.0 or earlier in your app, it should not affect you. |
Thank you for the information. However, the error suddenly occurred even though there was no particular update, etc. for the already released app. |
In my case, there is no way to get the FCM token, and everything changed from January 17, and my app has been in production for 2 months, and it just broke, since notifications are an important part of the app, I do not allow to log in without there being a token, and just as of yesterday in iOS no new installations log in anymore. |
I don't know how to solve obtaining the token, the problem happens no matter what version of FCM I have, the first thing I do when starting the app from 0 is to check if the permissions are there, if they aren't I request them, but this never runs . |
@shinwenli @dpa99c Have you found any solution to the problem? |
@adirgan As I already wrote, the interim workaround in my case was to catch the error that occurred in "window.FirebasePlugin.getToken" with "trycatch" and call "window.FirebasePlugin.getToken" again . |
@shinwenli The same error keeps happening, apparently I have to get the APN token first before initializing the firebase autoStart I'm trying to see how I can fix it |
@adirgan I'm sorry I can't help you. |
@shinwenli My problem is that I need push notifications, and I still can't find a way to obtain the token |
@adirgan In my case, the modal message to get permission for notifications was showing and then (after allowing notifications) I was getting an error. |
@shinwenli I'm looking at what the correct order is, if first ask for permission, and then try to get the APN token, I'm not sure, the log still doesn't show anything useful |
@shinwenli I tell you that I already found the solution, the first thing you have to do is use these 2 functions, hasPermission and grantPermission, if the permission is accepted you use these functions getAPNSToken and onApnsTokenReceived, the last function is an observable, at the moment that this observable gives you return the ios APN token, then you can already get the FCM token without any problem. And with that everything is solved, you will always get the token, if you have the permission and you have the APN Token first. Checking the Firabase SDK iOS github, the problem is that they changed the Firebase backend API, and the API no longer accepts saving an FCM token without which the APN is created first, therefore you always have to verify that have the permissions and request the APN token before requesting the FCM Token |
@shinwenli Yes, it is indeed a problem that FCM originated, but for them it is not a bug, and what they want, according to what I see on github, is that in their DB there are no FCM Tokens without APN Tokens, and that is why now it is mandatory that the APN always be there. token first |
@adirgan That information is very informative for me. I thought that "getToken()" was the flow of processing to get even the APNs token. So, does Firebase currently send push notifications from FCM without APNs tokens? |
@shinwenli It was like that until 2 days ago, but with this change in the SDK API, it is no longer possible to do that, now you always have to obtain the APN Token first and then use getToken() Before when I let you create the FCM Token without the APN, a notification would never arrive to that phone, but before when you used the getToken() after requesting the notification permission it was automatic that it created the APN, now you just have to do the logic complete oneself |
@adirgan With the latest SDK released the other day, I was able to learn that it is necessary to acquire APNs first as you said. |
@shinwenli Right now doing tests, apparently they put it back as before, that is, if you have an older version of SDK FCM than 10.4.0, you can continue working with getToken(), they just changed it about 20 minutes ago, but I think it's important work as I told you before and update to version 10.4.0, so as not to have problems in the future. firebase/firebase-ios-sdk#10679 the last comment indicated that they made a pullback of the changes made to the server |
From today, my app has received many error reports from iOS users.
The error message is as follows.
Probably, it occurs at the time of the following function call
The error handling that is the second argument of "getToken" is called and the error of "Error Domain=com.google.fcm Code=0..." is passed.
This is where the app throws an error.
However, as far as chasing the logs in XCode, the token itself seems to have been acquired afterwards.
A log of "didRecievedRegistrationToken ..." was being obtained.
If I then restarted the application, I was able to get the token and continue processing without error.
Maybe it's a problem on the Firebase side.
Do you have any information?
The Firebasex plugin version I'm currently using is 14.2.1.
In addition, as a workaround for the time being, it seems possible to start normally by calling "window.FirebasePlugin.getToken" again in the error handling using "try catch".
The text was updated successfully, but these errors were encountered: