我在 Flutter iOS 应用中尝试使用 Firebase Messaging 获取令牌时遇到错误。错误消息如下:
FLTFirebaseMessaging: An error occurred while calling method Messaging#getToken, errorOrNil => { NSLocalizedFailureReason = "Invalid fetch response, expected '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 (package:flutter/src/services/message_codecs.dart:651:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
<asynchronous suspension>
#2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:534:43)
<asynchronous suspension>
#3 MethodChannelFirebaseMessaging.getToken (package:firebase_messaging_platform_interface/src/method_channel/method_channel_messaging.dart:248:11)
<asynchronous suspension>
#4 FCMToken.getFcm (package:instahire/firebase/fcm_token.dart:5:21)
<asynchronous suspension>
#5 SplashController.getToken (package:instahire/controllers/splash_controller.dart:42:23)
<asynchronous suspension>
直到昨天它还运行正常,突然出现此错误。如何解决?
是的,我已经添加了这两样东西,但同样的问题仍然存在。如果我需要做什么,请告诉我,因为它突然停止了,我不知道出了什么问题。
我更新了 Firebase 消息插件,我们必须使用不同的方法来获取令牌,例如
尝试这个命令:
Pod deintegrate
Pod install
并运行代码。
好像钥匙丢了,
GoogleService-Info.plist
到项目中FirebaseApp.configure()
是否在询问令牌之前调用了