FIRMessagingRemoteMessage' 已弃用:FCM 直接通道已弃用,请使用 APNs 进行下游消息处理

问题描述

我已经向我的 Flutter 应用程序添加了 firebase 消息传递,它在 android 上运行良好,但在 ios 上运行不正常。

我使用了 firebase_messaging 软件包并遵循了所有安装说明。 当我尝试在 ios 模拟器上运行我的 ios 应用程序时,我看到了这个错误

  /Users/admin/Documents/Flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-7.0.3/ios/Classes/FLTFirebaseMessagingPlugin.m:190:43: warning: 'FIRMessagingRemoteMessage' is deprecated: FCM direct channel is
    deprecated,please use APNs for downstream message handling. [-Wdeprecated-declarations]

我已将 APN 文件添加到我的 firebase 项目,我还将所有需要的 firebase 包添加到我的配置文件中。

target 'Runner' do
  pod 'Firebase/Analytics'
  pod 'Firebase/Auth'
  pod 'Firebase/Firestore'
  pod 'Firebase/Messaging'
  use_frameworks!
  use_modular_headers!

  Flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

我还在 AppDelegate.swift添加了所有必需的代码,如 firebasefirebase_messaging 的文档中所述:

import UIKit
import Flutter
import Firebase

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedpluginRegistrant.register(with: self)
    FirebaseApp.configure()
if #available(iOS 10.0,*) {
  UNUserNotificationCenter.current().delegate = self
};
return super.application(application,didFinishLaunchingWithOptions: launchOptions);
  }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)