【问题标题】:Universal links not redirecting to app but site is approved通用链接未重定向到应用程序但网站已获批准
【发布时间】:2022-08-02 20:37:56
【问题描述】:

在我的 React Native 应用程序中,我正确设置了深度链接

const config = {
  screens: {
    AppNavigator: {
      screens: {
        HomeComponent: \'home\',
        Component1: \'test/:id\',
        Component2: \'test/:page/:id\',
      },
    },
  },
}
const linking = {
  prefixes: [\'myapp://\', \'https://com.myapp.test\'],
  config,
}

我相信它们是正确的,因为如果我运行命令 npx uri-scheme open myapp://home 我会被重定向到正确的页面。

接下来我在 Xcode 和我的

<?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>aps-environment</key>
    <string>development</string>
    <key>com.apple.developer.associated-domains</key>
    <array>
        <string>applinks:myapp.page.link</string>
        <string>applinks:myapp.page.link</string>
        <string>applinks:myapp.com?mode=developer</string>
        <string>applinks:*.myapp.com?mode=developer</string>
    </array>
</dict>
</plist>

我添加了developer 标志,因为我正在以开发人员模式连接到 Xcode 的手机上对其进行测试。

然后我将apple-app-site-association 文件添加到我的服务器上的.well-known 子文件夹:

  \"applinks\": {
    \"defaults\": {
      \"caseSensitive\": false
    },
    \"details\": [
      {
        \"appIDs\": [
          \"1111111111.com.myapp.test\",
          \"1111111111.com.myapp.test.test\",
        ],
        \"components\": [
          {
            \"/\": \"/test/*\"
          },
          {
            \"/\": \"home\"
          }
        ]
      }
    ]
  }
}

如果我检查电话上swcutil_show.txt 文件的日志,我会看到以下日志:

--------------------------------------------------------------------------------
Service:              applinks
App ID:               1111111111.com.myapp.test
App Version:          408.0
App PI:               <LSPersistentIdentifier 0x149e36c70> { v = 0, t = 0x8, u = 0x328, db = 617262B3-586B-49F1-8832-EF960F7380F8, {length = 8, bytes = 0x2803000000000000} }
Domain:               myapp.com?mode=developer
Patterns:             {\"/\":\"/test/*\",\"caseSensitive\":false}
User Approval:        unspecified
Site/Fmwk Approval:   approved
Flags:                developer
Last Checked:         2022-01-11 17:20:26 +0000
Next Check:           2022-01-16 17:00:15 +0000
--------------------------------------------------------------------------------

但是,当我在 Apple Note 应用程序上按一个 url 时,我登陆了该网站,但我没有被重定向到该应用程序。

非常感谢任何输入。谢谢!

标签: react-native deep-linking ios-universal-links


【解决方案1】:

你可以试试没有“www”的网址吗?

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
【解决方案2】:

您是否尝试过本地服务器或实时服务器?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-03-07
    • 2014-10-27
    • 2017-01-03
    • 1970-01-01
    • 2020-05-17
    • 2020-07-16
    • 2021-12-30
    • 1970-01-01
    相关资源
    最近更新 更多