Closed AlexHodges13 closed 2 months ago
Thanks for the report... ...but I don't understand, go_router won't do anything by itself. Somewhere in your source code, you should have a directive set to tell go_router where to go.
Hello, I'm encountering the same problem with the Go router and app link. After handling the link (deep link), the Go router navigation is not functioning properly and presents an issue like path not found
Console Logs as [GoRouter] No initial matches: /xt8603gr [GoRouter] Using MaterialApp configuration
[GoRouter] pushing /
@llfbandit I found the root cause and have fixed this issue. In the class SwiftAppLinksPlugin.swift, there is a has function link. need return true value when call function handleLink(url: url)
// Universal Links
public func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([Any]) -> Void
) -> Bool {
switch userActivity.activityType {
case NSUserActivityTypeBrowsingWeb:
if let url = userActivity.webpageURL {
handleLink(url: url)
return true // true to indicate that your app handled the activity
}
return false
default: return false
}
}
@llfbandit I found the root cause and have fixed this issue. In the class SwiftAppLinksPlugin.swift, there is a has function link. need return true value when call function handleLink(url: url)
// Universal Links public func application( _ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]) -> Void ) -> Bool { switch userActivity.activityType { case NSUserActivityTypeBrowsingWeb: if let url = userActivity.webpageURL { handleLink(url: url) return true // true to indicate that your app handled the activity } return false default: return false } }
@vanvu08t2 I just tested out your proposed change and it did indeed fix my issue!! 💯 🙇 Thank you!!
@llfbandit do you have any concerns with me opening a PR containing this one liner change?
This change has been reverted. Don't use go_router deep linking feature: https://docs.flutter.dev/cookbook/navigation/set-up-universal-links#add-support-for-go_router
Describe the bug
I am using AppLinks in conjunction with GoRouter in my flutter app. My current setup works as expected while testing on the Android version of my flutter app, however I'm getting some unexpected behavior while testing on the iOS flutter app.
In iOS when I click a link that is from one of my associated domains defined in the iOS app capabilities, the AppLinks uriLinkStream listener that I have set up DOES trigger in response to the url (as expected). However, at the same time, my GoRouter attempts to navigate to this route (which is not defined as a supported route in the GoRouter configuration) and throws an error on the screen saying
Exception: Match error found during build has Exception: no routes for location
Is there a way to prevent the GoRouter from handling the route so that only AppLinks handles it? Again, this is only a problem in iOS and does not behave this way on Android. Therefore, I'm wondering if I have my custom app delegate setup incorrectly in the iOS app configuration. Here's what I have currently for my custom app delegate:
Does it related to
[ ] App Links (Android)
[ ] Deep Links (Android)
[X] Universal Links (iOS)
[ ] or Custom URL schemes? (iOS)
Does the example project work?
[X] Yes
[ ] No
[ ] Irrelevant here
Did you fully read the instructions for the targeted platform before submitting this issue?
Uploaded your files to webserver, HTTPS, direct connection, scheme pattern setup, ...
[X] Yes
[ ] No
[ ] Irrelevant here