AppDelegate.swift 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import UIKit
  2. import Flutter
  3. @main
  4. @objc class AppDelegate: FlutterAppDelegate {
  5. override func application(
  6. _ application: UIApplication,
  7. didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  8. ) -> Bool {
  9. navigateToSpecialPage()
  10. let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
  11. let channel = FlutterMethodChannel(name: "channel_name", binaryMessenger: controller.binaryMessenger)
  12. channel.setMethodCallHandler({ (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
  13. if let url = URL(string: "my://") {
  14. UIApplication.shared.open(url, options: [:], completionHandler: nil)
  15. }
  16. if (call.method == "getPlatformVersion") {
  17. result(UIDevice.current.systemVersion)
  18. } else {
  19. result(FlutterMethodNotImplemented)
  20. }
  21. })
  22. GeneratedPluginRegistrant.register(with: self)
  23. return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  24. }
  25. func navigateToSpecialPage() {
  26. print("11111111111111111111")
  27. }
  28. }