简体   繁体   English

深度链接Xamarin iOS

[英]Deep-linking Xamarin iOS

I need to add deep linking feature to my app with Xamarin iOS. 我需要使用Xamarin iOS向我的应用程序添加深层链接功能。 My info.plist looks like this: 我的info.plist看起来像这样:

<key>CFBundleURLTypes</key>
<array>
<dict>
  <key>CFBundleURLSchemes</key>
  <array>
    <string>domine.somthing/index.html?UV</string>
  </array>
  <key>CFBundleURLTypes</key>
  <string>com.domine.somthing/index.html?UV</string>  
</dict>

I seems not working due to "/" char in the URL. 由于网址中的“ /”字符,我似乎无法正常工作。 How am I supposed to write CFBundleURLTypes and CFBundleURLSchemes URL values in order to make it work? 我应该如何编写CFBundleURLTypesCFBundleURLSchemes URL值才能使其正常工作?

Deep links can returns users directly to your application. 深层链接可以将用户直接返回到您的应用程序。 After adding URI support to your application like you did, just clicking on a URL consisting of a scheme name for your application will launch your app, but it seems you are filling CFBundleURLSchemes and CFBundleURLTypeswith with wrong values. 在像向您的应用程序添加URI支持之后,只需单击由应用程序的方案名称组成的URL即可启动您的应用程序,但似乎您用错误的值填充了CFBundleURLSchemesCFBundleURLTypeswith

CFBundleURLName - Usually, this corresponds to the bundle ID of your application. CFBundleURLName通常,它对应于您的应用程序的捆绑软件ID。 Please see Apple's Development doc for more informations. 请参阅Apple的开发文档以获取更多信息。

CFBundleURLSchemes - Array of strings containing URL scheme names, usually at least your application's name (without spaces). CFBundleURLSchemes包含URL方案名称的字符串数组,通常至少是您的应用程序名称(不带空格)。 Pay attentiont to ensure these values are unique to your application. 请注意确保这些值对于您的应用程序是唯一的。

Look at this sample: 看这个例子:

<key>CFBundleURLTypes</key>
  <array>
    <dict>
      <key>CFBundleURLName</key>
      <string>com.yourcompany.yourapp</string>
      <key>CFBundleURLSchemes</key>
      <array>
        <string>appname</string>
      </array>
    </dict>
  </array>

Now clicking on a URL consisting of appname:// on the device will launch your app. 现在,在设备上单击由appname://组成的URL,将启动您的应用程序。

If you want to send a user to a specific part of your application, you need to add arguments to this URL, making a deep link. 如果要将用户发送到应用程序的特定部分,则需要向该URL添加参数,以进行深层链接。 Here is a sample with a path and query: 这是带有路径和查询的示例:

appname://custompath?customquery=customvalue

When a user clicks a URL containing your scheme ( appname:// ), your app's delegate is called and specifically the method OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) where you can handle schemas an execute correct app routing based on schema arguments (if provided). 当用户单击包含您的方案的URL( appname:// )时,将调用您的应用程序的委托,尤其是方法OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) ,您可以在其中处理架构并执行正确的应用程序路由基于模式参数(如果提供)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM