Xamarin 通用链接不请求 apple-app-site 文件

Xamarin Universal Linking not requesting apple-app-site file

我正在尝试在我的 iOS Xamarin 应用程序中实现通用链接。我已将 apple-app-site-association 文件上传到我的服务器,将其作为 application/json 发送并进行测试以确保其下载。

然后我将以下内容添加到 Entitlements.plist:

<dict>
    <key>com.apple.developer.associated-domains</key>
    <array>
        <string>applinks:mydomain.com</string>
        <string>applinks:*.mydomain.com</string>
    </array>
</dict>

我需要跨所有子域的链接,所以我的理解是包括根域和通配符条目,因此包括上面的两个条目。 apple-app-site-association 文件由根域和所有子域提供。

我正在通过 Visual Studio 在调试模式下测试我的应用程序到实际设备 (iPhone XS)。我的理解是,当安装该应用程序时,它会尝试从服务器下载 apple-app-site-association 文件,但是,当我检查我的服务器日志时,没有发生这种情况的记录。

我尝试从 phone 中删除该应用程序,重新构建并再次 运行,但没有成功。

我试过使用浏览器访问 apple-app-site-association 文件,它加载了,服务器日志显示它被请求。

很明显,我的通用链接不起作用的原因是我的应用程序从不请求此文件,但我现在不知所措,无法理解原因。

在 Xamarin 中设置通用链接的步骤 iOS:

  1. apple-app-site-association 文件上传到您网站的根目录或 .well-known 子目录中,并确保它通过 HTTPS

    提供

    1.1 如果它是通过 HTTPS 提供的并且您不需要定位 iOS8,请不要费心去尝试 签署 JSON 文件。一个简单的 JSON 文件就可以了。

  2. 在 Apple Developer Center 中为您的应用启用 “Associated Domains” 功能并重新生成 provisioning 配置文件

  3. 在“Associated Domains

  4. 部分中将您要为其添加通用链接的域添加到您的 iOS Entitlements file
  5. 确保添加应用链接:prefix (ex. applinks:ctcode.wordpress.com) 在 AppDelegate class

  6. 中实现逻辑

参考:universal links and universal-links-in-ios