avioli / uni_links

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

Flutter iOS Universal link only opens the app but is not handled #162

Open AndrewPiterov opened 1 year ago

AndrewPiterov commented 1 year ago
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.developer.associated-domains</key>
    <array>
        <string>applinks:myapp.page.link</string>
    </array>
</dict>
</plist>

In the end, when I get from Firebase a link for verifying email, e.g. https://myapp.page.link/__/auth/action?mode=verifyEmail&.... I try to open this Universal link from some email app then iOS navigates me to my app, but the app does not get the link with uriLinkStream to handle it. But if I change the mentioned link into a Custom link as myapp://__/auth/action?mode=verifyEmail&.... my app handles the Custom link as expected.

Shortly,

What could I be missing for Universal link?

resultanyildizi commented 1 year ago

In my case, there was another package which overrides the application:openURL:options: and application:continueUserActivity:restorationHandler: methods of UIApplication and they were returning true.

This was causing the uni_link package to never be able to catch the incoming urls. I have just reconfigured the other package to return false if the url is not about its logic and that solved the problem.

shihabfromparallax commented 1 year ago

In my case, there was another package which overrides the application:openURL:options: and application:continueUserActivity:restorationHandler: methods of UIApplication and they were returning true.

This was causing the uni_link package to never be able to catch the incoming urls. I have just reconfigured the other package to return false if the url is not about its logic and that solved the problem.

How did you reconfigure that? I am trying to use firebase dynamic links with it. I think I have the same issue as yours. How can I solve it?

RichardRaue commented 1 year ago

Same here. Firebase Dynamic Links keeps blocking uni_links from receiving the uriLinkStream or initialUri. Any ideas on how to solve this?

resultanyildizi commented 1 year ago

Why do you need both Firebase Dynamic Links and uni_links at the same time? As far as I know they have similar purposes.

RichardRaue commented 1 year ago

Think I got it to work. I our case we had ONE domain to handle DeepLinks (www.ourdomain.com) and another to handle FirebaseDynamic Links (app.ourdomain.com). Problem was, I added both domains under FirebaseDynamicLinksCustomDomains in Info.plist file.

After deleting the DeepLink url from that entry, all works well: Firebase handles its links, and leaves all others to uni_links.

loolooii commented 1 year ago

Why do you need both Firebase Dynamic Links and uni_links at the same time? As far as I know they have similar purposes.

If you want to send people to the App Store or Google Play when they don't have the app installed, I think that's the only way. It also has support for Analytics and other stuff.

loolooii commented 1 year ago

Think I got it to work. I our case we had ONE domain to handle DeepLinks (www.ourdomain.com) and another to handle FirebaseDynamic Links (app.ourdomain.com). Problem was, I added both domains under FirebaseDynamicLinksCustomDomains in Info.plist file.

After deleting the DeepLink url from that entry, all works well: Firebase handles its links, and leaves all others to uni_links.

I'm not using a custom domain. I have myApp.page.link that should link to my actual URL. Can you explain a bit more in detail how you solved it?

njzimpli commented 8 months ago

In my case, there was another package which overrides the application:openURL:options: and application:continueUserActivity:restorationHandler: methods of UIApplication and they were returning true.

This was causing the uni_link package to never be able to catch the incoming urls. I have just reconfigured the other package to return false if the url is not about its logic and that solved the problem.

In my case, i custom application:continueUserActivity:restorationHandler: for handle Call Recents History when select a history call should open my application / call screen and i also use uni_link as well.

Bug:

override func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
  if (call_history) {
    // open call screen in my app.
    return true
  }
  return false
}

Work fine:

override func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {

  if (call_history) {
   // My custom code
  }

  // Don't for get to return super.
  return super.application(application, continue: userActivity, restorationHandler: restorationHandler)
}
Anoirwork commented 7 months ago

got the same behaviour when the app is in background but it does work when the app is terminated. any guide ?

rahulsharma9893 commented 7 months ago

@objc class AppDelegate: FlutterAppDelegate, MessagingDelegate { override func application( application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { FirebaseApp.configure() Messaging.messaging().delegate = self GeneratedPluginRegistrant.register(with: self) if #available(iOS 10.0, *) { // For iOS 10 display notification (sent via APNS) UNUserNotificationCenter.current().delegate = self let authOptions: UNAuthorizationOptions = [.alert, .sound] UNUserNotificationCenter.current().requestAuthorization( options: authOptions, completionHandler: {, _ in }) } else { let settings: UIUserNotificationSettings = UIUserNotificationSettings(types: [.alert, .sound], categories: nil) application.registerUserNotificationSettings(settings) }

application.registerForRemoteNotifications()
return super.application(application, didFinishLaunchingWithOptions: launchOptions)

} }

im using this for in my "appdelegate.swift" file I need above code for notification and dont want to remove it I have no experience in swift, how to add/change code for deep link in this file?