美文网首页iOS经验总结
一键唤醒之Universal Links 避坑

一键唤醒之Universal Links 避坑

作者: 守护地中海的花 | 来源:发表于2021-09-18 22:33 被阅读0次

    Deeplink(深度链接)是一种能够实现应用之间无缝跳转的技术。在移动端,DeepLink能够实现从H5页面直接跳转到目标App具体页面的功能。
    下面将记录一些细节

    • path保持一致 微信开放平台和apple-app-site-association的路径
    • 自检函数不用的时候必须关闭哦

    场景

    比如分享网页在微信中打开 然后点击网页 去app 打开app(没有安装则跳到AppStore)

    微信开放平台 (参考)

    • 验证指引
    • SDK接入指引
    • 使用SDK自检函数排查接入问题

    补充微信平台并测试

    1.在微信应用中设定Universal Links

    请填写能唤起当前应用的Universal Links路径(https开头,以“/”结尾, 建议带path,比如“ https://your_domain/app/ ”),在实际调用SDK时,会校验Universal Links是否匹配

    image.png
    备注:我这里是前任已经设定这个路径 我也没办法 最好写简单点单词 这里必须和后面的apple-app-site-association文件里面的paths对应

    2.打开Associated Domains功能

    • 在Xcode打开 applinks:www.jifuedu.cn
      规则: applinks:域名

      image.png
    • 到 Certificates, Identifiers & Profiles 中 选中Identifiers 开启Associated Domains功能


      image.png
    • 从新配置证书才能运行打包哦 如果自动证书此步无需关注

    3.配置apple-app-site-association(path必须和微信开放平台的Universal Links 的path一致)

    这个文件不要有任何后缀名

    path必须和微信开放平台的Universal Links 的path一致

    {
        "applinks": {
            "apps": [],
            "details": [
                {
                    "appID": "Team ID.bundldId",
                    "paths": [ "/apple-app-site-association/*" ]
                }
            ]
        }
    }
    

    Team ID:

    image.png

    Bundle Identifier:

    image.png

    测试 又是大坑

    大坑 不需要记得关闭该方法 不调用即可

    image.png

    如果上述的自检函数没问题 基本没问题

    或者在记事本中打开 复制 Universal Links 到记事本然后打开(效果如下面gif图)

    在微信打开这个链接也能打开的

    QQ20210918-223112-HD.gif

    相关文章

      网友评论

        本文标题:一键唤醒之Universal Links 避坑

        本文链接:https://www.haomeiwen.com/subject/hnwygltx.html