-
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. |
... How did you fix it to make it work properly? I tried to run it and it still had the same error. It didn't work properly again? |
I'll reopen the issue and it will be automatically closed once the PR is merged. |
Try clearing your pods and reinstall them again? Might be that the old packages were stuck there and your app was built with the cached ones. |
Did you remove |
firebase_messaging:
git:
url: https://github.com/firebase/flutterfire.git
ref: messaging-13558
path: packages/firebase_messaging/firebase_messaging Works for me, but, is it worth the fix to production, or wait a few days for the official release? |
Not working for me. And yes i remove [firebase_messaging/apns-token-not-set] APNS token has not been set yet. Please ensure the APNS token is available by calling `getAPNSToken()`. |
I've been facing the same issue. Finally, I've tried to solve this issue according to the below code. firebase_messaging: ^15.1.3 FirebaseMessaging messaging = FirebaseMessaging.instance;
}Please put the sticker emotion if you have been tried it successfully, thank you |
please read the comments in here and know that this is not the proper fix. |
@zamvar please share your screenshot that you've failed to fix I've proven that I've fixed it myself after read some above comments here. |
you clearly misunderstood me, yes you eliminated the exception you are getting but read this if you still dont get why youre solution is not proper read on how FCM connects with Apples Notification Service. the proper fix is on the way you can use it by adding this on your pubspec.yaml clear pods, clear pub cache, delete and build or you can wait for it to be merged |
For Android, getToken() works fine however it can't get token in iOS before show error "firebase_messaging/iOS: Invalid fetch response, expected 'token' or 'Error' key". In the solution, add the getAPNSToken() for iOS, then it is running as well using iPhone 16 Pro. Have you tried the simulator iOS for testing getToken() instead of getAPNSToken()? |
based on your response you clearly dont understand why i said that fix is incorrect, please refer why im telling you to ready how FCM connects with APN and how getAPNSToken is used and why it shouldnt be used if you are sending the notifcation via FCM. |
Thanks for clarifying this. |
I have same issue FLTFirebaseMessaging: An error occurred while calling method Messaging#getToken, errorOrNil => { any fix? |
@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 |
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: