Milad-Akarie / auto_route_library

Flutter route generator
MIT License
1.59k stars 405 forks source link

DeepLinking not working for iOS #1598

Open maxmitz opened 1 year ago

maxmitz commented 1 year ago

auto_route version: 7.4.0

My problem is that deep links do work fine for Android but the "deepLinkBuilder" function does not get triggered (I tried it with break points) when I open the app with a link or the command line (xcrun simctl openurl booted https:///details) with iOS. I followed the setup steps from the Flutter documentation and from auto_route.

The app does open but the Deeplink is not triggered. I want to refer to a special screen in my app. With VSC I do not get a console print. In xCode I get "[Firebase/Analytics][I-ACS023000] Deep Link Web URL query is empty". Could this have something to do with it?

It is not possible for me to post a reproducible example because you need to upload the AASA file to your website.

Does somebody have the same issue, does have a workaround, or do see another issue that it could be?

Tell me if you have ideas for further information that I could provide.

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.7.12, on macOS 13.3.1 22E772610a darwin-arm64, locale de-DE) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 14.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.3) [✓] VS Code (version 1.78.1) [✓] Connected device (5 available) [✓] HTTP Host Availability

sjoulbak commented 1 year ago

@maxmitz I believe your issue is with the scheme https. I can remember that I had to changed it to something else in order to get it to work for iOS by configuring CFBundleURLSchemes. For consistency reasons I would recommend to change it for Android as well by configuring android:scheme.

jfacoustic commented 1 year ago

@sjoulbak Do you have any more information besides changing the URL scheme to something else? That's a little vague.

jfacoustic commented 1 year ago

I'm having a similar problem. I'm using Firebase dynamic links to generate the deep link, and it is working correctly on Android but not iOS.

I can manually listen to the link opening the app from the Firebase package, but deepLinkBuilder is never being invoked. As far as I can tell, I have Info.plist/build configurations set up correctly.

sjoulbak commented 1 year ago

@jfacoustic I can give you an example configuration:

# ios/Runner/Info.plist
<?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>FlutterDeepLinkingEnabled</key>
        <true/>
        <key>CFBundleURLTypes</key>
        <array>
            <dict>
                <key>CFBundleTypeRole</key>
                <string>Editor</string>
                <key>CFBundleURLName</key>
                <string>whooff.nl</string>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>whooff</string>
                </array>
            </dict>
        </array>
    </dict>
</plist>

With above configuration you can deeplink to: whooff://whooff.nl/home/dashboard

kane-knowby commented 1 year ago

Hi, I'm currently experiencing the same issue with deepLinkBuilder not working for iOS. Unfortunately the above workaround is not suitable. For now I am forced to use uni_links to work around the issue.

Is the underlying issue for this problem known?

KarinBerg commented 1 year ago

I recommend to check if your Universal Links stuff is correctly configured on the Apple site. Especially the hosting of the "apple-app-site-association" file. For this use the AASA Validator from Branch.io to verify if your Associated Domains are correctly configured. If this check fails, then the problem is not auto_route. Here is a guide for what you have to do to configure universal links for your iOS app: https://www.branch.io/resources/blog/how-to-setup-universal-links-to-deep-link-on-apple-ios/

Hint: If the AASA Validator tells you that the "content-type" header is wrong, then upload your "apple-app-site-association" file again with the file suffix .json.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

fabienbranchel commented 1 year ago

Same issue here. Like @kane-knowby, my only solution is to use uni_links, and it's pretty annoying, even more when deepLinkBuilder works as expected on Android.

github-actions[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

k-ane commented 11 months ago

Anyone made any progress here? Our associated domains are setup correctly so I'm quite sure it's not that. We were able to work around the issue with uni_links but shouldn't have to

KBEMobisys commented 11 months ago

@k-ane Which auto_route version do you use and have you tried to use the latest one? Also which flutter and Xcode version do you use?

github-actions[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions

kane-knowby commented 9 months ago

I finally found out what the issue was here! It relates to this: https://github.com/flutter/flutter/issues/123813

Even though I wasn't using uni_links at all, just depending on the package caused the issue. I removed the dependency, flutter clean and flutter pub get, then all worked as expected!

github-actions[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions