0
votes

I'm getting those error when using FCM plugin in IOS, anyone know why and how I can solve this issue ? Btw it works in Android.

════════════════════════════════════════════════════════════════════════════════════════════════════
[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<…>

Here a code sample where those error came from :

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method requestNotificationPermissions on channel plugins.flutter.io/firebase_messaging)

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)] Unhandled Exception: MissingPluginException(No implementation found for method getToken on channel plugins.flutter.io/firebase_messaging)

_firebaseMessaging.getToken().then((token) {
  print("Firebase Messaging Token: $token\n");
  usersRef.document(firebaseUser.uid).updateData({"FCMToken": token});
});

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method configure on channel plugins.flutter.io/firebase_messaging)

_firebaseMessaging.configure(
      onLaunch: onPush,
      onResume: onPush,
      onMessage: onPush,
      onBackgroundMessage: Platform.isIOS ? null :onBackgroundPush,
    );
 }

Here my 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)
  }

}

I already followed all the steps specified in the https://pub.dev/packages/firebase_messaging for IOS integration : enter image description here APNs and all... Anyone know how to solve this ?

1
run: ' flutter doctor ' in the terminal and add to your question if there are any issues in the output of thatgg11

1 Answers

1
votes

I just found the solutions to my problem, I was getting those errors because I add flutter apns plugin in my project, which disable fcm plugins. Removing it solve my problem.