Flutter应用deeplink打开android应用但无法打开ios应用

问题描述 投票:0回答:1

我的问题是这样的;

我正在尝试为我的 flutter 应用程序实现深度链接功能。我按照官方文档上的步骤进行操作https://docs.flutter.dev/cookbook/navigation/set-up-universal-links Android 应用程序正在打开,但 ios 应用程序未通过链接打开。

我将 Deeplink 属性添加到 info.plist 文件中。 enter image description here

我还通过开发者模式添加了关联域功能。

enter image description here

我还使用

https://branch.io/resources/aasa-validator/
检查了 apple-app-site-association 文件的可访问性 enter image description here

到目前为止,一切似乎都正常,但是当我尝试使用深层链接打开应用程序时

 xcrun simctl openurl booted https://<my-domain>/login_screen
,

应用程序无法打开,并将我发送到一个网页,说它找不到具有该路径的页面。

enter image description here

我一直在寻找解决方案,但找不到任何解决方案。我不确定我是否遗漏了一点。知道什么可能导致这种行为以及如何解决这种情况吗?

更新1:我找到了一个测试CDN的链接;

https://app-site-association.cdn-apple.com/a/v1/<my-domain>

但这只返回给我一条文字“未找到”。这可能意味着 CDN 无法访问我的 AASA 文件。然而,Branch.io AASA 验证器表示我的文件没问题。当我输入网址

https://<my-domain>/.well-known/apple-app-site-association
时我也可以看到该文件。还是没有解决。

更新:2

我在互联网上发现了一些东西,可以帮助人们了解当他们尝试输入链接时发生的情况。我发现的是这个; curl -v https://app-site-association.cdn-apple.com/a/v1/<my-domain>

当您在终端中输入此代码时,它会提供尝试输入我们提供的 URL 时发生的操作的详细输出。这是我在终端输入代码时的终端日志;

* Connected to app-site-association.cdn-apple.com (17.253.107.201) port 443 (#0) * ALPN: offers h2,http/1.1 * (304) (OUT), TLS handshake, Client hello (1): * CAfile: /etc/ssl/cert.pem * CApath: none * (304) (IN), TLS handshake, Server hello (2): * (304) (IN), TLS handshake, Unknown (8): * (304) (IN), TLS handshake, Certificate (11): * (304) (IN), TLS handshake, CERT verify (15): * (304) (IN), TLS handshake, Finished (20): * (304) (OUT), TLS handshake, Finished (20): * SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256 * ALPN: server accepted http/1.1 * Server certificate: * subject: C=US; ST=California; O=Apple Inc.; CN=app-site-association.cdn-apple.com * start date: Sep 29 18:10:48 2023 GMT * expire date: Dec 28 18:20:48 2023 GMT * subjectAltName: host "app-site-association.cdn-apple.com" matched cert's "app-site-association.cdn-apple.com" * issuer: CN=Apple Public Server ECC CA 12 - G1; O=Apple Inc.; ST=California; C=US * SSL certificate verify ok. * using HTTP/1.1 > GET /a/v1/<my-domain> HTTP/1.1 > Host: app-site-association.cdn-apple.com > User-Agent: curl/8.1.2 > Accept: */* > < HTTP/1.1 404 Not Found < Apple-Failure-Details: {"cause":"local error: tls: no renegotiation"} < Apple-Failure-Reason: SWCERR00303 TLS error < Apple-From: https://<my-domain>/.well-known/apple-app-site-association < Apple-Try-Direct: false < Cache-Control: max-age=3600,public < Content-Length: 10 < Content-Type: text/plain; charset=utf-8 < Date: Mon, 02 Oct 2023 08:25:18 GMT < Age: 5 < Via: https/1.1 dkvib1-3p-pst-004.ts.apple.com (acdn/4.1), https/1.1 dkvib1-3p-pac-004.ts.apple.com (acdn/4.1), https/1.1 dkvib1-3p-pfe-014.ts.apple.com (acdn/4.1), https/1.1 dkblp1-edge-lx-008.ts.apple.com (acdn/4.1), https/1.1 dkblp1-edge-bx-007.ts.apple.com (acdn/4.1) < X-Cache: hit-stale, miss, miss, miss, miss < CDNUUID: 94a11630-9b2a-4bd9-b1cb-a26474607b0a-199948940 < Connection: keep-alive < Not Found * Connection #0 to host app-site-association.cdn-apple.com left intact

那么这是什么意思呢?是我的网络服务器的配置有问题还是苹果的连接协议不同。我不明白。还是没有解决。

ios flutter deep-linking ios-universal-links
1个回答
0
投票

首先,你的域名应该是域名,而不是链接。

https://app-site-association.cdn-apple.com/a/v1/example.com

你喜欢这样吗? 然后根据我的经验,在 iOS 应用程序中使用 aasa 需要一些时间。我想,看来我们必须等到苹果接受并缓存你的 aasa 文件。 希望我的建议对您有帮助。 谢谢。

© www.soinside.com 2019 - 2024. All rights reserved.