sha*_*nad 2 deep-linking xamarin.ios
我需要使用 Xamarin iOS 向我的应用程序添加深层链接功能。我的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>
Run Code Online (Sandbox Code Playgroud)
由于 URL 中的“/”字符,我似乎无法正常工作。我应该如何编写CFBundleURLTypes和CFBundleURLSchemesURL 值以使其工作?
深层链接可以将用户直接返回到您的应用程序。像您一样向您的应用程序添加 URI 支持后,只需单击由您的应用程序的方案名称组成的 URL 即可启动您的应用程序,但似乎您正在填充CFBundleURLSchemes并且CFBundleURLTypeswith使用错误的值。
CFBundleURLName- 通常,这对应于您的应用程序的包 ID。有关更多信息,请参阅Apple 的开发文档。
CFBundleURLSchemes- 包含 URL 方案名称的字符串数组,通常至少是您的应用程序名称(不含空格)。请注意确保这些值对于您的应用程序是唯一的。
看看这个样本:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.yourcompany.yourapp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>appname</string>
</array>
</dict>
</array>
Run Code Online (Sandbox Code Playgroud)
现在单击设备上的 URLappname://将启动您的应用程序。
如果要将用户发送到应用程序的特定部分,则需要向此 URL 添加参数,创建深层链接。这是一个带有路径和查询的示例:
appname://custompath?customquery=customvalue
Run Code Online (Sandbox Code Playgroud)
当用户单击包含您的方案 ( appname://)的 URL 时,您的应用程序的委托将被调用,特别是OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)您可以处理架构并根据架构参数(如果提供)执行正确的应用程序路由的方法。
| 归档时间: |
|
| 查看次数: |
1780 次 |
| 最近记录: |