应用间跳转与Applinks

2016-12-15  本文已影响1231人  li_礼光

iOS应用间跳转的教程.
应用间跳转(Obj-C)

简单总结:

1.A程序与B程序,B程序需要被打开,在B工程中的target - info - URL types下 ,设置自己的Url scheme.
2.A要打开B程序,如果要执行判断该URL是否能被打开,在A工程中需要设置被名单,设置白名单,在info.plist中设置对应的key: LSApplicationQueriesSchemes
3.如果不判断canOpenUrl,那么就可以不设置白名单.(貌似白名单数量限制90,没验证过)

实际应用的例子

应用内商品.PNG 购买界面.PNG 第三方商城选择.PNG 应用跳转.PNG

关于applinks的一些介绍

Facebook推App Link:解决应用内容互通问题
官方介绍applinks

Applinks介绍.png 原理图.png

哪里会用到?

按钮编辑.png 链接设置.png

设置方式:

1.A custom URL that will be used to launch your app.
2.The app store ID / package that will handle the content.
3.The app name that will handle the content.

在要访问的站点的地址,头部添加这部分元数据

<html>
<head>
    <meta property="al:ios:url" content="example://applinks" />
    <meta property="al:ios:app_store_id" content="12345" />
    <meta property="al:ios:app_name" content="Example App" />
    <meta property="og:title" content="example page title" />
    <meta property="og:type" content="website" />
    <!-- Other headers -->
</head>
<!-- Other HTML content -->
</html>
</head>

举个例子:
要跳转的app应用设置了url为 myapp , iOS之间程序间跳转可以通过

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"myapp://"]];

那么可以设置

<meta property="al:ios:url" content="myapp://applinks" />
(其实主要也就是这个myapp://)

总结:
整理完然后再看看百度AppLink正式发布这篇内容,其实应用间跳转苹果已经有一套app to app跳转的机制,applinks的提出说是简化了应用之间的深度链接,我目前还没感受出来,目前总结的是applinks提供了一种新的方式,打破了app to app的跳转方式,可以通过web to app的方式跳转.

上一篇 下一篇

猜你喜欢

热点阅读