iOS 使用 xamarin.forms 的应用链接

App links for iOS using xamarin.forms

使用 Xamarin.forms 并在 NuGetPackages 上获取 AndroidAppLinks 我能够将链接关联到我的应用程序并使其打开我想要的页面。我正在尝试对 iOS 做同样的事情。关于这个,我有两个问题:

  1. 有这种东西吗?
  2. 如何制作?

我已经在 App.xaml.cs 上覆盖了方法 protected override void OnAppLinkRequestReceived(Uri uri),我还用 Application.Current.AppLinks.RegisterLink(entry) 注册了该条目,并且我尝试更改 Info.plist 添加此条目:

<key>CFBundleURLTypes</key>
  <array>
    <dict>
      <key>CFBundleURLName</key>
      <string>http://relacionamento.com.br/senha</string>
      <key>CFBundleURLTypes</key>
      <string>Viewer</string>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>example</string>
      </array>
    </dict>
  </array>

我尝试过使用铆钉,但我得到的是 Android:

Severity Code Description Project File Line Suppression State Error Could not install package 'Microsoft.Bcl.Build 1.0.14'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. 0

这是 iOS:

Severity Code Description Project File Line Suppression State Error Could not install package 'Microsoft.Bcl.Build 1.0.14'. You are trying to install this package into a project that targets 'Xamarin.iOS,Version=v1.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

尝试在表单中安装,我得到:

Severity Code Description Project File Line Suppression State Error Could not install package 'Rivets 1.0.5'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. 0

我必须使用铆钉吗? 我还需要什么才能使用这些链接?

此致

iOS 等同于 Android App Links 称为 Universal Links,并随 iOS 9 引入。据我所知没有用于在 Xamarin 上启用通用链接的 Nuget 包,但是有一个非常详细的演练来设置所有可用的东西 here

Rivets 包适用于 Facebook App Links — 一个完全不同的标准,恰好具有相同的名称。

一次处理所有这些事情的替代方法是 Branch.io (full disclosure: I'm on the Branch team) deep linking platform. This is available as a Nuget package and you can find full documentation here