【问题标题】:How to make deep links work in flutter when opened with gmail?使用gmail打开时如何使深层链接颤动?
【发布时间】:2020-08-24 09:54:15
【问题描述】:

我正在尝试在我的颤振应用中实现深度链接。我正在使用uni_links 颤振包。

我正在将我的应用程序的深层链接发送到用户的电子邮件帐户。但是,在 gmail 中,您需要在 href 值中使用 http 协议,否则 gmail 将不会将其视为有效链接。因此,我不得不在电子邮件中使用以下链接:

<a href="https://myexample.flutter.dev">Click here</a>

而不是像这样的链接,

<a href="myexample://flutter.dev">Click here</a>

现在有了https://myexample.flutter.dev,当我从 gmail 打开链接时,它并没有打开我的应用程序。

但是,如果我将CFBundleURLSchemes 密钥更改为myexample 并将CFBundleURLName 更改为flutter.dev,当我在浏览器中输入myexample://flutter.dev 时,它会打开我的应用程序。但是,就像我之前提到的,这在 gmail 中不被识别为有效链接。

这里有什么问题?我该如何解决这个问题?

这是我的ios/Runner/Info.plist

<array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>myexample.flutter.dev</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>https</string>
            </array>
        </dict>
    </array>

【问题讨论】:

    标签: ios flutter deep-linking url-scheme


    【解决方案1】:

    第一个是自定义链接你可以自己做

    <a href="myexample://flutter.dev">Click here</a>
    

    第二个是万能链接

    您需要在后端提供文件才能使其工作。

    通用链接仅适用于 https 方案,并且需要指定的主机、权利和托管文件 - apple-app-site-association。

    <a href="https://myexample.flutter.dev">Click here</a>
    

    UniversalLinksDocumentation

    PS。我认为现在到 2020 年底,处理深度链接的最佳方式是 Firebase 动态链接。也许未来的人会认为它应该更容易

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-20
      • 1970-01-01
      • 2020-07-23
      • 1970-01-01
      • 2019-11-27
      • 2023-01-04
      • 2017-07-05
      • 1970-01-01
      相关资源
      最近更新 更多