IOS调起app的终极方法:Universal Links

一、App“围墙

各个移动App就像大海中的一座座岛屿,虽然都生活在一个海洋中(Android系统或iOS),但是他们之间通常是老死不相往来。举例来说,在微信应用中,用户基本上就没有机会打开第三方应用APP,只能通过Web/浏览器方式提供受限的互通。

真实的用户需求是什么样的呢? 例如,用户在朋友圈中,看到关于一个饭店文章的时候,用户可以很方便打开大众点评应用看评论,直接打开美团查看折扣券,直接打开叫车软件前往该地点。 在信息流看到推荐的商品,能够直接打开淘宝/京东App查看宝贝详情。但是很不幸,目前这些应用孤岛之间都是通过Web进行连接的,通过WebView,进行内容跳转,缺少原生App体验。

二、App 调起方式

1. Scheme协议调起  

2. Universal Links  ( IOS 9+)

3. Android App Links (Android 6.0 +)       (兼容性不好)

三、Scheme

客户端应用可以向操作系统注册一个 URL scheme,该 scheme 用于从浏览器或其他应用中启动本应用。通过指定的 URL 字段,可以让应用在被调起后直接打开某些特定页面

letvclient://msiteAction

但是这些在微信(优酷,爱奇艺)里是统统禁止的!

四、Universal Links( IOS9+)

When you support universal links, iOS users can tap a link to your website and get seamlessly redirected to your installed app without going through Safari. If your app isn’t installed, tapping a link to your website opens your website in Safari.

 

Unique. Unlike custom URL schemes, universal links can’t be claimed by other apps, because they use standard HTTP or HTTPS links to your website.

Secure. When users install your app, iOS checks a file that you’ve uploaded to your web server to make sure that your website allows your app to open URLs on its behalf. Only you can create and upload this file, so the association of your website with your app is secure.

五、使用Universal Links

1.上传 apple-app-site-association文件(固定格式,如下图)到你自己网站根目录或者 /.well-known 目录。要安装SSL使支持https

IOS调起app的终极方法:Universal Links_第1张图片IOS调起app的终极方法:Universal Links_第2张图片

各公司的 apple-app-site-association

乐视:  https://m.letv.com/apple-app-site-association                                 爱奇艺: https://www.iqiyi.com/apple-app-site-association 

优酷:  https://link-jump.youku.com/apple-app-site-association

对应的Universal Links:(一条普通的http或者https链接)

乐视:    https://m.letv.com/u_links/                                                        测试apple-app-site-association 是否有效

爱奇艺:https://www.iqiyi.com/app/                                                       https://search.developer.apple.com/appsearch-validation-tool/

优酷:    https://link-jump.youku.com/a/play/

六、Universal LinksScheme的区别

Scheme

letvclient://msiteAction

Universal Links

http://m.letv.com/u_links

七、注意的几点

1:必须IOS9以上。

2浏览器中点击Universal Link时,如果这个link和页面是同一个域名,则不走调起,而是当做普通链接在当前浏览器打开。

3成功调起app后,app的右上角的 state bar有在safari(letv.com)打开的选项,如果你点击了它,它会跳转到safari,同时系统会认为你选择使用safari打开该域名的链接,而不调起app。以后你再点击该链接,它只会在safari里面跳转

该如何再次开启:

(1)safari页面中,手指往下拉动一下页面,会显示出一个“隐藏”的banner,俗称 smart banner,右侧是一个button:打开(open),点击它,就又会开启app跳转功能。

(2) 把链接粘贴到记事本或者短信,长按后选择 在xxxAPP中打开。

(3)在微信里面用到的地址是:

http://a.app.qq.com/o/simple.jsp?pkgname=com.letv.android.client&ckey={key}&android_schema={当前url地址}

你可能感兴趣的:(IOS调起app的终极方法:Universal Links)