【问题标题】:flutter remote push notification(fcm) not working IOS颤动远程推送通知(fcm)不工作IOS
【发布时间】:2021-12-29 01:05:18
【问题描述】:
  1. android 运行良好

2.从firebase站点到iOS真机运行良好(下面这个推送到ios就可以了) 3. 从iOS远程推送到安卓效果很好

  1. 但无法向 iOS 远程推送消息

我的 Xcode

我的信息

我的 Appdelegate.swift

import UIKit
  import Flutter
  import Firebase

   @UIApplicationMain
   @objc class AppDelegate: FlutterAppDelegate {
     override func application(
      _ application: UIApplication,
      didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey:     Any]?
    ) -> Bool {
      FirebaseApp.configure() //add this before the code below

      GeneratedPluginRegistrant.register(with: self)
      return super.application(application, didFinishLaunchingWithOptions:  launchOptions)
    }
}
 

【问题讨论】:

    标签: ios flutter firebase-cloud-messaging


    【解决方案1】:

    其实我也遇到过这个问题,经过长期研究发现我没有允许通知权限,所以使用permission_handler插件请求远程通知权限。

    像这样:

    Future<Map<Permission, PermissionStatus>> requestPermission() async {
      Map<Permission, PermissionStatus> statuses = await [
        Permission.notification
      ].request();
      return statuses;
    }
    
    • 卸载应用程序
    • 添加以上代码
    • 启动时调用此函数
    • 给予许可

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-26
    • 1970-01-01
    • 1970-01-01
    • 2018-03-05
    相关资源
    最近更新 更多