如何在iOS上排除Universal Link的根(React Native),它是不稳定

ig9co6j1  于 12个月前  发布在  iOS
关注(0)|答案(1)|浏览(112)

我正在为我的React Native应用程序跟踪这个guide,我正在测试iOS的Universal Link。
现在,我只希望Deep Link在/launch.html上打开我的应用程序,而不是在root上,但似乎我域中的所有子路径都打开了我的应用程序。
是否:

  1. https:<random-domain>.ngrok-free.app
  2. https:<random-domain>.ngrok-free.app/test
  3. https:<random-domain>.ngrok-free.app/launch.html
    我只想让它在第三个案子里有用。
    这是我的AASA档案:
{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "ABC123.com.test.Test",
        "paths": [
          "/launch/*",
          "NOT *",
        ]
      },
      {
        "appID": "ABC123.com.test.Test",
        "paths": [
          "NOT /",
          "NOT *"
        ]
      }
    ]
  }
}

正如你所看到的,我已经尝试将它放在paths数组的第一个对象条目中,并且还添加了第二个对象条目"root"
我将它部署在我的Express服务器上,使用NGROK在https://<domain>/.well-known/apple-app-site-association下运行。
我在我的权利中添加了这个生成的域:

<?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>com.apple.developer.associated-domains</key>
    <array>
        <string>applinks:<random-domain>.ngrok-free.app</string>
        <string>applinks:<random-domain>.ngrok-free.app?mode=developers</string>
    </array>
</dict>
</plist>

这是我的server.js

const express = require("express");
const app = express();
const port = 3000;

// Explicitly set content type for AASA file
app.get("/.well-known/apple-app-site-association", (req, res) => {
  response.sendFile(__dirname + "/apple-app-site-association");
});

app.listen(port, () => {
  console.log(`Server is running on port ${port}`);
});
9w11ddsr

9w11ddsr1#

使用components添加一个路径,类似这样:

{
    "applinks": {
        "details": [
            {
                "appIDs": [
                    "ABC123.com.test.Test"
                ],
                "components": [
                    {
                        "/": "/launch"
                    }
                ]
            }
        ]
    }
}

详情请参见applinks.Details.Components

相关问题