友盟微信通用链接配置

1、苹果后台appid开启Associated Domains,重新生成描述文件,证书不用重新生成
2、工程Capabilities -> Associated Domains添加域名applinks:www.xx.com applinks后面的域名不加https
3、微信后台universal link传入https://域名/ 注意https开头/结尾
4、LSApplicationQueriesSchemes添加wechat、weixin和weixinULAPI
5、域名根目录下配置文件apple-app-site-association,内容如下

{
    "applinks": {
        "apps": [],
        "details": [
        {
            "appID": "teamid.bundleid",
            "paths": [ "*"]
        },
        {
            "appID": "teamid.bundleid",
            "paths": [ "*"]
        }
        ]
    }
}

6、appdelegate里设置系统回调,必须设置,负责会出现微信和app来回跳的问题
//设置Universal Links系统回调

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray> * _Nullable))restorationHandler{
    
    if (![[UMSocialManager defaultManager] handleUniversalLink:userActivity options:nil]) {
        NSLog(@"其他SDK的回调");
    }
    return YES;
}

7、配置友盟universal link参数

[UMSocialGlobal shareInstance].universalLinkDic = @{@(UMSocialPlatformType_WechatSession):kWXUniversalLinks};

8、微信通用链接检查,调试使用,调试完屏蔽,总共7步,都通过则没有问题,如果第6步有问题会卡在第4或5步

 [WXApi startLogByLevel:WXLogLevelDetail logBlock:^(NSString * _Nonnull log) {
        NSLog(@"微信日志%@",log);
    }];
    NSLog(@"微信版本:%@",[WXApi getApiVersion]);
    [WXApi registerApp:kWXAppKey universalLink:kWXUniversalLinks];
    [WXApi checkUniversalLinkReady:^(WXULCheckStep step, WXCheckULStepResult * _Nonnull result) {
        NSLog(@"微信日志检查 %@, %u, %@, %@", @(step), result.success, result.errorInfo, result.suggestion);
    }];

你可能感兴趣的:(友盟微信通用链接配置)