当我在IOS中使用FCM插件时,有人知道为什么和如何解决这个问题吗?顺便说一句,它适用于安卓系统。
════════════════════════════════════════════════════════════════════════════════════════════════════
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method requestNotificationPermissions on channel plugins.flutter.io/firebase_messaging)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
<asynchronous suspension>
#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
#2 FirebaseMessaging.requestNotificationPermissions (package:firebase_messaging/firebase_messaging.dart:87:21)
#3 _HomeState.getIOSPermission (package:in_jesus_name/screens//home.dart:153:24)
#4 _HomeState.configurePushNotificationsFirebaseUser (package:in_jesus_name/screens//home.dart:227:7)
<asynchronous suspension>
#5 _HomeState.handleFirebaseSignIn (package:in_jesus_name/screens//home.dart:143:9)
<asynchronous suspension>
#6 _HomeState.initState.<anonymous closure> (package:in_jesus_name/screens//home.dart:822:7)
#7 _rootRunUnary (dart:async/zone.dart:1192:38)
#8 <…>
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getToken on channel plugins.flutter.io/firebase_messaging)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
<asynchronous suspension>
#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
#2 FirebaseMessaging.getToken (package:firebase_messaging/firebase_messaging.dart:150:27)
#3 _HomeState.configurePushNotificationsFirebaseUser (package:in_jesus_name/screens//home.dart:245:24)
#4 _rootRunUnary (dart:async/zone.dart:1192:38)
#5 _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#6 _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#7 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#8 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#9 Future._completeWithValue (dart:async/future_impl.dart:526:5)
<…>
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method configure on channel plugins.flutter.io/firebase_messaging)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
<asynchronous suspension>
#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
#2 FirebaseMessaging.configure (package:firebase_messaging/firebase_messaging.dart:114:14)
#3 _HomeState.configurePushNotificationsFirebaseUser (package:in_jesus_name/screens//home.dart:250:24)
#4 _rootRunUnary (dart:async/zone.dart:1192:38)
#5 _CustomZone.runUnary (dart:async/zone.dart:1085:19)
#6 _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#7 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#8 Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#9 Future._completeWithValue (dart:async/future_impl.dart:526:5<…>这里是一个代码示例,这些错误来自于:
VERBOSE-2:ui_dart_state.cc(157)未处理异常:MissingPluginException(没有在通道plugins.flutter.io/firebase_messaging)上为方法requestNotificationPermissions找到实现
getIOSPermission() {
_firebaseMessaging.requestNotificationPermissions(
IosNotificationSettings(alert: true, badge: true, sound: true));
_firebaseMessaging.onIosSettingsRegistered.listen((settings) {
print("Settings registered:$settings");
});
}VERBOSE-2:ui_dart_state.cc(157)未处理异常:MissingPluginException(没有在通道plugins.flutter.io/firebase_messaging)上为方法getToken找到实现
_firebaseMessaging.getToken().then((token) {
print("Firebase Messaging Token: $token\n");
usersRef.document(firebaseUser.uid).updateData({"FCMToken": token});
});VERBOSE-2:ui_dart_state.cc(157)未处理异常:MissingPluginException(没有为通道plugins.flutter.io/firebase_messaging)上的方法配置找到实现)
_firebaseMessaging.configure(
onLaunch: onPush,
onResume: onPush,
onMessage: onPush,
onBackgroundMessage: Platform.isIOS ? null :onBackgroundPush,
);
}这里我的AppDelegate.swift:
import UIKit
import Flutter
import Firebase
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}我已经遵循了https://pub.dev/packages/firebase_messaging for IOS集成中指定的所有步骤:

APN之类的..。有人知道怎么解决这个问题吗?
发布于 2020-07-02 09:35:28
我刚刚找到了我的问题的解决方案,我得到了这些错误,因为我在我的项目中添加了颤振apns插件,它禁用fcm插件。移除它解决了我的问题。
https://stackoverflow.com/questions/62687683
复制相似问题