通用链接不会重定向到应用商店

时间:2021-10-26 15:53:32

I am trying to implement setup Universal Link for IOS 9 device with both side configuration.Firstly I have done configuration at server Side with steps:

我正在尝试使用两种配置为IOS 9设备实现设置Universal Link。首先,我在服务器端完成了配置步骤:

1.created one unsigned apple-app-site-association-unsigned.txt file and file contents is

1.创建一个未签名的apple-app-site-association-unsigned.txt文件,文件内容为

{
        "activitycontinuation": {
            "apps": [
              "9JA89QQLNQ.com.apple.wwdc"
            ]
          },
        "applinks": {
                "apps": [],
                "details": [
                    {
                        "appID":"9JA89QQLNQ.com.apple.wwdc",
                        "paths": [
                                        "*",
                                        "/"
                                ]
                    }
                ]
            }
     } 

2.Did sign the above mentioned file using

2.使用标记上述文件

cat apple-app-site-association-unsigned.txt | openssl smime -sign -inkey demo.key -signer demo.crt -certfile demo.pem -noattr -nodetach -outform DER > apple-app-site-association

cat apple-app-site-association-unsigned.txt | openssl smime -sign -inkey demo.key -signer demo.crt -certfile demo.pem -noattr -nodetach -outform DER> apple-app-site-association

3.then it is created on signed file i.e apple-app-site-association

3.然后在签名文件上创建,即apple-app-site-association

4.moved this file into root server where my certificates are available.

4.将此文件移动到我的证书可用的根服务器中。

5.created one endpoint with node.js

5.使用node.js创建一个端点

var https = require('https');
var fs=require('fs');
var express = require('express');
var privateKey  = fs.readFileSync(home_path + 'src/Server/API/demo.key', 'utf8');
var certificate = fs.readFileSync(home_path + 'src/Server/API/demo.crt', 'utf8');
var credentials = {key: privateKey, cert: certificate};
var app = express();
var httpsServer = https.createServer(credentials, app);
httpsServer.listen(8443);
console.log('deeplink service listening on port 3501');    
var aasa = fs.readFileSync('./apple-app-site-association');
app.get('/apple-app-site-association', function(req, res, next) {
    console.log("Request landed on 8443 port.");
     res.set('content-type', 'application/pkcs7-mime');
     res.status(200).send(aasa);
});

6.then my end point is:- https://domain.com:8443/apple-app-site-association

6.然后我的终点是: - https://domain.com:8443/apple-app-site-association

7.My app is not installed in device then if I copied universal link i.e https://domain.com:8443/apple-app-site-association in Ios 9 safari browser,it is not redirecting to App store, instead of that it is displaying apple-app-site-association file to download.

7.我的应用程序未安装在设备中然后如果我在Ios 9 safari浏览器中复制了通用链接,即https://domain.com:8443/apple-app-site-association,它不会重定向到App Store,而不是它正在显示要下载的apple-app-site-association文件。

Note:- I did only server side configuration,so that if my app in not installed it should redirect to app store.

注意: - 我只进行了服务器端配置,因此,如果我的应用程序未安装,则应重定向到应用商店。

Any idea on this where I am wrong?

对此我有什么想法吗?

1 个解决方案

#1


4  

I believe you may be fundamentally misunderstanding how Universal Links work. You should do some additional research into Universal Links to make sure you have the concept correct. This might be a good place to start.

我相信你可能从根本上误解了Universal Links的工作方式。您应该对Universal Links进行一些额外的研究,以确保您的概念正确无误。这可能是一个很好的起点。

That said, a few things that may help:

也就是说,一些可能会有所帮助的事情:

  1. You can't implement Universal Links on just one half of the equation. For anything to work, you need both the server and in-app components.
  2. 您不能仅仅在等式的一半上实现通用链接。要做好任何工作,您需要服务器和应用内组件。
  3. iOS is very particular about where it looks for the apple-app-site-association file. It will not check on port 8443. The easiest option is to use the standard HTTPS port (443), but assuming your signing attempts are valid, non-HTTPS should also work (port 80).
  4. iOS在寻找apple-app-site-association文件的位置非常讲究。它不会检查端口8443.最简单的选择是使用标准HTTPS端口(443),但假设您的签名尝试有效,非HTTPS也应该有效(端口80)。
  5. The URL https://domain.com/apple-app-site-association (extraneous port reference removed) itself is not a Universal Link. This is simply a validation file you need to host so that when you implement Universal Links in your app, iOS is able to confirm you own and control the domain in question.
  6. URL https://domain.com/apple-app-site-association(删除了无关的端口引用)本身不是通用链接。这只是您需要托管的验证文件,以便在您的应用中实施通用链接时,iOS可以确认您拥有并控制相关域。
  7. Universal Links don't automatically handle redirection to the App Store. They simply control whether the app opens (if it is installed) or the website loads (if the app is not installed). The website that is loaded when the app is not installed needs to implement the App Store redirect.
  8. Universal Links不会自动处理重定向到App Store。他们只是控制应用程序是打开(如果已安装)还是网站加载(如果未安装应用程序)。未安装应用程序时加载的网站需要实现App Store重定向。

Many apps don't even attempt to handle all of this complexity, especially since Universal Links are still only a partial solution to deep linking (they don't work in Facebook, Twitter, or any app using SFSafariViewController, amongst others), so you may want to look into an external link routing service. Branch.io (full disclosure: I'm on the Branch team) is a good option and handles all of these technical details for you.

许多应用程序甚至没有尝试处理所有这些复杂性,特别是因为Universal Links仍然只是深层链接的部分解决方案(它们不适用于Facebook,Twitter或任何使用SFSafariViewController的应用程序等),所以你可能想要查看外部链接路由服务。 Branch.io(完全披露:我在分支团队)是一个很好的选择,并为您处理所有这些技术细节。

#1


4  

I believe you may be fundamentally misunderstanding how Universal Links work. You should do some additional research into Universal Links to make sure you have the concept correct. This might be a good place to start.

我相信你可能从根本上误解了Universal Links的工作方式。您应该对Universal Links进行一些额外的研究,以确保您的概念正确无误。这可能是一个很好的起点。

That said, a few things that may help:

也就是说,一些可能会有所帮助的事情:

  1. You can't implement Universal Links on just one half of the equation. For anything to work, you need both the server and in-app components.
  2. 您不能仅仅在等式的一半上实现通用链接。要做好任何工作,您需要服务器和应用内组件。
  3. iOS is very particular about where it looks for the apple-app-site-association file. It will not check on port 8443. The easiest option is to use the standard HTTPS port (443), but assuming your signing attempts are valid, non-HTTPS should also work (port 80).
  4. iOS在寻找apple-app-site-association文件的位置非常讲究。它不会检查端口8443.最简单的选择是使用标准HTTPS端口(443),但假设您的签名尝试有效,非HTTPS也应该有效(端口80)。
  5. The URL https://domain.com/apple-app-site-association (extraneous port reference removed) itself is not a Universal Link. This is simply a validation file you need to host so that when you implement Universal Links in your app, iOS is able to confirm you own and control the domain in question.
  6. URL https://domain.com/apple-app-site-association(删除了无关的端口引用)本身不是通用链接。这只是您需要托管的验证文件,以便在您的应用中实施通用链接时,iOS可以确认您拥有并控制相关域。
  7. Universal Links don't automatically handle redirection to the App Store. They simply control whether the app opens (if it is installed) or the website loads (if the app is not installed). The website that is loaded when the app is not installed needs to implement the App Store redirect.
  8. Universal Links不会自动处理重定向到App Store。他们只是控制应用程序是打开(如果已安装)还是网站加载(如果未安装应用程序)。未安装应用程序时加载的网站需要实现App Store重定向。

Many apps don't even attempt to handle all of this complexity, especially since Universal Links are still only a partial solution to deep linking (they don't work in Facebook, Twitter, or any app using SFSafariViewController, amongst others), so you may want to look into an external link routing service. Branch.io (full disclosure: I'm on the Branch team) is a good option and handles all of these technical details for you.

许多应用程序甚至没有尝试处理所有这些复杂性,特别是因为Universal Links仍然只是深层链接的部分解决方案(它们不适用于Facebook,Twitter或任何使用SFSafariViewController的应用程序等),所以你可能想要查看外部链接路由服务。 Branch.io(完全披露:我在分支团队)是一个很好的选择,并为您处理所有这些技术细节。