天天看点

iOS Universal Links 使用方法

配置文件

文件名:​

​apple-app-site-association​

{
    "applinks":{
        "apps":[],
        "details":[
            {
                "appID":"teamID.bundleID",
                "paths":["*"]
            }
        ]
    }
}      

​paths​

​​说明:

填写:"/customer/"

当用户点击网址"你的域名/customer/list"这个链接的时候,才会跳转到你的app

如果点击"你的域名/order"这样的链接就不会跳转了

​​

​*​

​号代表任一路径

配置

  • 开发者官网设置:

    Certificates, Identifiers & Profiles -> Identifiers ->

    开启对应项目​​

    ​bundleID​

    ​​ 下的 ​

    ​associate domains​

  • Xcode中的设置:

    1.applinks

    Target–>Capablities–>Associated domains

    添加该项

    点+号添加域名

    可以添加多个

    格式为:applinks:服务器域名

    2.info.plist

    info.plist -> LSApplicationQueriesSchemes 添加 ​​

    ​weixinULAPI​

  • 唤醒逻辑:

    Appdelegate.m文件,实现下面的方法:

- (BOOL)application:(UIApplication*)application continueUserActivity:(NSUserActivity*)userActivity restorationHandler:(void(^)(NSArray*_Nullable))restorationHandler  {
   NSLog(@" %@",userActivity.webpageURL.description);
   returnYES;
}      

后端的事

服务器根目录下创建一个​

​well-known​

​​子目录

将该配置文件​​

​apple-app-site-association​

​​上传到这个目录

完整链接是:​​

​https://服务器域名/well-known/apple-app-site-association​

微信开放平台

继续阅读