Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AndrewPiterov opened this issue Dec 22, 2022 · 10 comments
Open

Comments

@AndrewPiterov
Copy link

  • Using uni_links package;
  • Configured the app to use Universal link and Custom links. For Universal link added ios/Runner/Runner.entitlements which looks like as below
<?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>
  • Configured uriLinkStream and getInitialUri;

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,

  • tapping on Universal link only opens the app, but not handled for further processing.
  • Custom link is working as expected.

What could I be missing for Universal link?

@resultanyildizi
Copy link

resultanyildizi commented Jan 10, 2023

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
Copy link

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
Copy link

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

@resultanyildizi
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@rahulsharma9893
Copy link

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants