微信内部直接跳转iOS APP,没安装直接跳转AppStore
必备配置
1.微信开放平台
2.UniversalLink
3.服务器配置
4.分享流程
详细配置
此项目默认UniversalLink 为 https://www.baidu.com/share/
配置文件apple-app-site-association
{
"applinks":{
"apps":[],
"details":[
{
"appID":"apple开发网站Identifiers App ID Prefix(Team ID).Bundle ID ",
"paths":["/share/*"]
}
]
}
}
1.微信开放平台
- 打开微信开放平台,按文档进行配置。
- 注意点,配置文件path必须加通配符*。
- 微信开放平台填入域名和微信SDK初始化的UniversalLink为
https://www.baidu.com/share/
2.UniversalLink
- 工程打开内打开Asspciated Domains,配置
applinks:www.baidu.com
,填入域名,不需要带路径。 - 证书打开Asspciated Domains。
3.服务器配置
- 将apple-app-site-association文件上传服务器,打开
https://www.baidu.com/apple-app-site-association
可以下载此文件代表配置成功。 - 在safari打开
https://www.baidu.com/share/
下滑可以打开app表示配置正确。 - 上传一个跳转App Store的html,此处举例
open.html
:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="full-screen" content="yes">
<meta name="x5-fullscreen" content="true">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<title>App Name</title>
<style>
</style>
</head>
<body>
打开App Store.....
</body>
<script>
window.onload = () => {
setTimeout(() => {
location.href = "itms-apps://itunes.apple.com/app/id123456789(此处是appid)"
}, 1000)
}
</script>
</html>
- 将
https://www.baidu.com/
这个域名下的所有404重定向到open.html
。打开https://www.baidu.com/1234/
,显示打开App Store表示配置正确。
4.分享流程
- 通过微信分享
https://www.baidu.com/html/details/Information-details-share.html?infoId=3aa6debd9806c9462198f999f4eee903&infoType=1&funcCode=004001
- 微信内打开此h5,点击
在App内打开
h5代码:
function goIphone() {
if (isIPhone) {
location.href = 'https://www.baidu.com/share/html/details/Information-details-share.html?infoId=3aa6debd9806c9462198f999f4eee903&infoType=1&funcCode=004001';
}
}
- 此时在微信浏览器内打开第二个链接
https://www.baidu.com/share/html/details/Information-details-share.html?infoId=3aa6debd9806c9462198f999f4eee903&infoType=1&funcCode=004001
。如果安装了App就会直接打开App,如果没有安装就会跳转open.html
跳转到App Store
网友评论