import Flutter import UIKit @main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GeneratedPluginRegistrant.register(with: self) let controller = window?.rootViewController as! FlutterViewController FlutterMethodChannelManager.shared.setupMethodChannels(controller: controller) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { // 解析URL参数 let components = URLComponents(url: url, resolvingAgainstBaseURL: true) let path = url.path // 将URL信息传递给Flutter let controller = window?.rootViewController as! FlutterViewController let channel = FlutterMethodChannel(name: "keyboard_ios", binaryMessenger: controller.binaryMessenger) if path == "/login" { channel.invokeMethod("navigateToLogin", arguments: nil) } else if path == "/member" { channel.invokeMethod("navigateToMember", arguments: nil) } return true } }