Associated Domain 关联域:
Applinks
主要可以做三件事
1、universal links通用链接
2、handoff功能实现Mac 和 iPhone iPad操作的互传
3、实现共享web认证,web credentials 实现native app-to-web交互 (不知道什么东东)
起因: 微信更新sdk 添加universal link
iOS13有更新
可以通过component 匹配筛选制定参数和页面路径 (为了兼容iOS 12以及之前版本 component和paths可以同时存在)
iOS12之前适配
可以配置多个{appid和paths}对儿,实现同一域名服务器 被多个app公用 使用不同路径区分比如https://help.wechat.com/域名下加一个app目录https://help.wechat.com/app
原理:
Universal links use two technologies: The first is the same mechanism that powers Handoff between a web browser and a native app, and the second is Shared Web Credentials (for more information about these technologies, see Web Browser–to–Native App Handoff and Shared Web Credentials Reference)
环境:ngix环境和iis环境 移动端iOS 向下兼容iOS10 (iOS9才有通用链接)
步骤:
1、配置apple-app-site-association文件,并且配置多个app
{
"applinks":{
"apps":[ ],
"details":[
{
"appID":”TeamId.bundleid",
"paths":[“/app1/*"]
},
{
"appID":"TeamId.bundleid",
"paths":[“/app2/*" ]
}
]
}
}
通用链接:https://help.wechat.com/app1https://help.wechat.com/app2
2、app配置associated domain 为applinks:help.wechat.com
3、上传到https://help.wechat.com/域名服务器的根目录下
4、删除app 重新安装app 打开通用链接https://help.wechat.com/app1或者https://help.wechat.com/app2
5、safari验证 加载指定页面 记得下拉一下,看看有没有打开指定app的下拉框.
特殊说明:
1、 you can specify a wildcard by prefixing *
2、Domain matching is based on the longest substring in the applinks entries. To enable matching for both *.mywebsite.com and mywebsite.com, you need to provide a separate applinks entry for each
3、After an app successfully associates with a domain, it remains associated until the app is deleted from the device. During development, delete your app from your testing device each time you update the association file to immediately see your changes.
验证工具:检测域名是否支持
坑儿位:
1、服务器问题 公司ngix服务 会有重定向 没能配置成功~该用Windows系统服务器,iis无后缀名 不能下载 需服务器配置 (https://www.123admin.com/how-to-resolve-no-extension-on-iis/)
2、检验url/apple-app-site-association 可以下载了, 需要重新删除后再安装app 才能在safari中查看效果
3、多个app 公用同一个apple-app-site-association文件 需要配置多个appid 通过不同文件路径区分跳转那个app
Web Credentials
用于快速输入密码
参考文档:
1、官方文档
2、配置apple-app-site-association文件