My deep links on iOS aren’t working correctly (I followed the official Flutter guide on how to implement deep links). On Android, everything works perfectly fine, but on iOS (when the app is killed), the app just launches from the link but stays at the home page (doesn’t navigate to the correct route).
I use auto_route for routing.
This is my routerDelegate
in MaterialApp.router
:
routerDelegate: _appRouter.delegate(
deepLinkBuilder: (deepLink) {
if (RegExp(r'/oferta/[^/]+/[^/]+.*$')
.hasMatch(deepLink.path)) {
return deepLink;
} else {
return DeepLink.defaultPath;
}
},
),
2
Answers
First, when dealing with deep links on iOS, it’s essential to make sure you’ve set up the necessary configurations in your Xcode project. Here are some steps to follow:
URL Types in Info.plist: Ensure that your app’s
Info.plist
file has the URL Types configured correctly. You need to specify the URL scheme for your app, which should match the one you use in your deep links.Associated Domains: If your deep links involve domains (like
https://example.com/deeplink
), you need to set up Associated Domains in Xcode. This step is important for Universal Links, which are a more reliable way of handling deep links.Example: