avioli / uni_links

Flutter plugin for accepting incoming links.
BSD 2-Clause "Simplified" License
563 stars 303 forks source link

The app closes instantly when launching from custom scheme url - IOS #154

Open yadsbah opened 2 years ago

yadsbah commented 2 years ago

I'm using custom scheme and am testing on my iPhone6, iOS Simulator which is running iOS 15

the app works fine when I launch it from https (Universal Link) but when I try to launch it using Custom URL scheme it crashes instantly, dosent reach the main function ether.

Shuxin-Lai commented 10 months ago

Thanks to ChatGPT. Add the following code under AppDelegate.swift file:

  override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
      if let flutterViewController = window?.rootViewController as? FlutterViewController {
          let channel = FlutterMethodChannel(name: "uni_links", binaryMessenger: flutterViewController.binaryMessenger)
          channel.invokeMethod("getInitialLink", arguments: ["url": url.absoluteString])
      }
      return true
  }
thanhle1547 commented 8 months ago

Thanks to ChatGPT. Add the following code under AppDelegate.swift file:

It's worked, my app did launch, but when I'm continuing open another link, it's shows that uriLinkStream not working

thanhle1547 commented 8 months ago

After I changed the version of flutterfire_cli to 0.3.0-dev.19 and re-configure, it's fixed the issue