微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。