I’m going through a problem retrieving the FCM token on iOS in my Flutter app, which blocks push notifications for iOS customers.
FLTFirebaseMessaging: An error occurred whereas calling methodology Messaging#getToken, errorOrNil => {
NSLocalizedFailureReason = "Invalid fetch response, anticipated 'token' or 'Error' key";
}
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: [firebase_messaging/unknown] An unknown error has occurred.
#0 StandardMethodCodec.decodeEnvelope (bundle:flutter/src/providers/message_codecs.dart:648:7)
#1 MethodChannel._invokeMethod (bundle:flutter/src/providers/platform_channel.dart:334:18)
#2 MethodChannel.invokeMapMethod (bundle:flutter/src/providers/platform_channel.dart:534:43)
#3 MethodChannelFirebaseMessaging.getToken (bundle:firebase_messaging_platform_interface/src/method_channel/method_channel_messaging.dart:248:11)
#4 most important (bundle:sjdvs/most important.dart:77:19)
**Identical Error for Messaging#subscribeToTopic
FLTFirebaseMessaging: An error occurred whereas calling methodology Messaging#subscribeToTopic, errorOrNil => {
NSLocalizedFailureReason = "Invalid fetch response, anticipated 'token' or 'Error' key"**;
}
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: [firebase_messaging/unknown] An unknown error has occurred.
I up to date all Firebase dependencies, ran flutter clear
, and reinstalled iOS pods with pod set up --repo-update
. I anticipated the app to retrieve the FCM token on iOS because it does on Android, nevertheless it returned an error indicating an “Invalid fetch response, anticipated ‘token’ or ‘Error’ key.”
Surroundings:
-
Flutter Model: 3.22.1 (secure channel)
-
firebase_messaging: ^15.1.3
-
firebase_core: ^3.6.0
-
firebase_storage: ^12.3.4
-
cloud_firestore: ^5.4.4
-
iOS Deployment Goal: iOS 14.0
-
Xcode Model: 15.4