301 Redirect to Universal Link can‘t open app

这篇文章资料来自于网络,对部分知识整理,这里只是记录一下,仅供参考。

App Search Programming Guide: Support Universal Links

Allowing apps and websites to link to your content

Allowing apps and websites to link to your content | Apple Developer Documentation

        You can connect to content deep inside your app with universal links. Users open your app in a specified context, allowing them to accomplish their goals efficiently.

        When users tap or click a universal link, the system redirects the link directly to your app without routing through Safari or your website. In addition, because universal links are standard HTTP or HTTPS links, one URL works for both your website and your app. If the user has not installed your app, the system opens the URL in Safari, allowing your website to handle it.

        When users install your app, the system checks a file stored on your web server to verify that your website allows your app to open URLs on its behalf. Only you can store this file on your server, securing the association of your website and your app.

iOS 9 - Redirect to Universal Link not working

iOS 9 - Redirect to Universal Link not working - Stack Overflow

        Safari on iOS (9...who knows what will happen next week!) only responds to Universal Links when the user actually takes a specific action to open the URL. That's a slight generalization, but basically a good guideline. A 301 redirect doesn't qualify, so that's why your app isn't opening up.

注意以下几点

https://www.branch.io/resources/blog/3-steps-to-troubleshoot-ios-9-and-ios-10-universal-links/

通用链接可以禁用

        通用链接可以被禁用。

        当用户通过通用链接深度链接到应用程序时,iOS 会在屏幕右上角显示指向域名的向前箭头按钮。如果用户不小心点击该按钮,iOS 将禁用该域名-应用程序对的通用链接。要重新启用通用链接,用户必须长按链接并选择在 <<appname>> 中打开选项,如上面链接故障排除步骤 1 中所述。

通用链接不适用于 JavaScript 重定向

        不管怎样,您都无法重定向到链接并期望它在 iOS 上打开应用程序。通用链接旨在满足用户意图,如果包裹在另一个重定向到相关域的域中,则不会进行深度链接。

许多应用程序不支持通用链接。

        很多应用尚不支持通用链接。

        如果您点击 Instagram、Twitter 或 Facebook 等应用的链接,请不要指望该链接会直接打开您的应用。但是,它们确实可以在 Notes、iMessage、Slack、Whatsapp 等应用中使用。

        以下是我们不断更新的详细列表,以及如何让它们在某些不受支持的应用上运行的信息。

apple-app-site-association不能托管

TN3155: Debugging universal links | Apple Developer Documentation

        如果您的通用链接仍无法在应用中打开,请仔细查看 HTTP 响应标头和 AASA 内容。您可以使用以下命令在终端中打印 HTTP 响应标头和 AASA JSON 内容

% curl -v https://{domain}/.well-known/apple-app-site-association

        如果您看到 301 或 302 HTTP 响应状态代码,则表示您的网站正在进行 HTTP 重定向,托管 AASA 文件时不支持此操作。该文件必须可直接访问,无需任何重定向。

        不要将 AASA 托管在根域上并重定向到为子域提供服务,而是将 AASA 托管在 中包含的每个域和子域上applinks。例如,如果您有一个子域和通配符,请在此处为子域托管一个 AASA 文件:applinks:www.example.comapplinks:*.example.com

https://www.example.com/.well-known/apple-app-site-association

总结

只能用户点击Universal Links才能触发打开app

参考

Allowing apps and websites to link to your content | Apple Developer Documentation

https://medium.com/@sonerkaraevli/how-to-implement-ios-deep-linking-using-universal-links-step-by-step-deep-dive-guide-2024-fe3882b3017c

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值