-
Notifications
You must be signed in to change notification settings - Fork 4k
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
firebase_messaging/iOS: Invalid fetch response, expected 'token' or 'Error' key #13558
Comments
I am also facing this issue. Did you find any solution, @bqubique ? |
I have the same issue using https://github.com/invertase/firestore-ios-sdk-frameworks.git version 11.2.0 I downgrade to 11.0.0, everything works fine, I'm using flutter and I can't upgrade to firebase sdk version 11.4.0 untill firebase upgrade their packages dependencies in flutter. My problem occurs only on iOS simulator (using irestore-ios-sdk-frameworks.git version 11.2.0), but on physical devices everything works perfectly. my firebase packages after downgrading: |
@YashOEncureIT not yet... |
Hi @bqubique , thanks for the report. This seems to be related to firebase/firebase-ios-sdk#13969. I believe once we bump the iOS sdk version, this issue should be resolved. For the time being, can you try downgrading to see if that resolves your issue for now? |
HI I am facing the same issues, and also tried downgrading to: Without luck getting error code:
|
@SelaseKay unfortunately even after pinning the versions down to:
I still get the same issue. As I said, I have not updated my packages lately for this issue to occur :(. |
Having the same issue on two of my Flutter projects. I also did not make any changes to the codebase 1st project: 2nd project |
Hi. I have the same issue too. Have you found a solution yet? Please help me. |
Try using APNs token for now for iOS+? |
I noticed the problem only on iOS Emulator, I tested on physical iphone using release version and I got a token without problem. I searched chatgpt for a solution and the answer is: |
Until now, since February of this year, I have never had this issue. Tested on a range of iOS devices, simulators, my own physical iOS device I have never seen it happen. ChatGPT response is pretty generic tbh. As @SelaseKay said, they need to bump the iOS SDK version to alleviate this issue. |
I using APNs token. I using it about 11 month and not update or upgrade but it crashed again yesterday but in the meantime I didn't do anything or change anything. |
I have the same problem An error occurred while calling method Messaging#getToken, errorOrNil => { |
Relieved to hear that, but still it should not be happening. |
I have the same issue, I didn't change anything since the last time it worked ! firebase_core: ^2.14.0 |
same here |
I got the same issue, It's working in Real device but failed in Simulator. |
It all worked fine yesterday, not it doesn't. I didn't change anything in the project since yesterday. can anyone please help with this ? |
Yesterday I was still able to use it, but all day today I had the same problem as above. help me :(( |
I had the same issue, only in iOS. I fixed it by removing the APNs from Firebase and re-adding it. |
@letien91 Have you removed APNs Auth Key or APNs Certificates ? |
@letien91 If you could please specify in detail what you removed and re-added |
Yes, I removed the APNs and created new ones. Then, I replaced the old APNs in the Firebase console with the new ones. |
@ziqq didnt work for me at first until i clear my pub cache, and make sure that pub get gets the correct package |
what is the fix for this ?, can someone help? |
change your firebase_messaging:
git:
url: https://github.com/firebase/flutterfire.git
ref: messaging-13558
path: packages/firebase_messaging/firebase_messaging Then:
|
This solution works. But I understand that it has to be a kind of “patch” until a new version of the package is released, correct? What would be the final solution? Or can I leave the pubspec.yaml like this? |
You're right! We need to wait for a new release. This PR fixes the issue. |
Thank you very much for your quick response. I need to make a change in one of the apps, can I use this patch to make a new public release of my app, or do I necessarily have to wait for the new version of the package? |
You're welcome. |
Not working on iOS Simulator (iPhone 16 Pro Max), but it works on Android. Here’s what I tried:
Show message : |
UPD: Solved. |
Error getting token. iOS has been fixed, but the issue happens on android... I/flutter ( 4824): Error getting token: [firebase_messaging/unknown] java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: SERVICE_NOT_AVAILABLE |
This is still happening |
Still happening here |
Yes , it works for me |
please read the thread this is not the correct way to resolve the issue, and check the changelog for the package version 15.1.4 |
please check the changelog for 15.1.4 |
How do you use package 15.1.4? Flutterflow is setting my firebase messaging
to 15.1.3
…On Mon, 2 Dec 2024, 8:11 pm Barrientos Mark Zamie, ***@***.***> wrote:
Yes , it works for me I made a changing *getTokens()* to *getAPNSToken()*.
(Note: this is for simulator use only, to receive notifications in
production mode or real device, getToken() should be used.)
please read the thread this is not the correct way to resolve the issue,
and check the changelog for the package version 15.1.4
—
Reply to this email directly, view it on GitHub
<#13558 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BHAGDWKBK5L3FRTUHA4CSNT2DQP5TAVCNFSM6AAAAABQVZGHO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJQHE3DKMZXGM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
i use firebase_messaging 15.1.3 and it's worked |
but dont use getAPNSToken, i already explained it here before |
I am using
Anyone getting this one? |
That is a different error and it means you haven't uploaded your APNS Key in your firebase project, |
No, we use APNs authentication key and it is already in Firebase. |
It's working with getAPNSToken() and not getToken(), but that's not something I want to do. |
@yassine-bennkhay may be it take time to register the simulator device, may be... on real device everything works fine. |
I used:
But Future<String?> getFcmToken() async {
try {
String? fcmToken;
if (Platform.isIOS) {
final apnsToken = await fcm.getAPNSToken();
if (apnsToken != null) {
fcmToken = await fcm.getToken();
} else {
await Future.delayed(Duration(seconds: 3));
final apnsToken = await fcm.getAPNSToken();
if (apnsToken != null) fcmToken = await fcm.getToken();
}
} else {
fcmToken = await fcm.getToken();
}
return fcmToken;
} catch (e, s) {
log('error: $e\n stract: $s');
throw Exception('error: $e\n stract: $s');
}
} |
I've got the same issue, This generates the following error message: Here's what I tried without success:
I used:
Works well (got the token) on iOS Simulator 16.x, 17.x, 18.x. It seems that many people still have this issue despite the fix. |
Is there an existing issue for this?
Which plugins are affected?
Messaging
Which platforms are affected?
iOS
Description
Calling
FirebaseMessaging.instance.getToken()
throws this error:instead of
getToken
I usedgetAPNSToken()
method, which returns a token, but in the background, with-FIRDebugEnabled
flag enabled I can still see this error:11.2.0 - [FirebaseMessaging][I-FCM040002] Invalid fetch response, expected 'token' or 'Error' key
right after:
I'm using flavors with Flutter and have made sure that the correct
GoogleService-Info.plist
is being loaded based on the content object of the above-mentioned request.Android has no issues with the
getToken
method.Reproducing the issue
Use this flutterfire bundle-service-file script:
Firebase Core version
3.6.0
Flutter Version
3.24.3
Relevant Log Output
No response
Flutter dependencies
Expand
Flutter dependencies
snippetAdditional context and comments
Xcode 16.0
Build version 16A242d
iOS 18.0
The text was updated successfully, but these errors were encountered: