微信SDK(1.8.6)--Universal Links

前面配置请参考以下链接,描述的很详细(也可以自行百度,网上有很多教程):
http://www.cocoachina.com/articles/24610

以下是我遇到的问题:

一定要在微信开放平台后台设置 Universal Links,否则调起微信会提示Universal 验证不通过。

参考文档: https://developers.weixin.qq.com/community/develop/doc/00062412e00e4878f8290f35457801?highLine=Universal%2520Links

0.png

以下是回调处理:

iOS 13上才走以下代理:

// iOS 13 Universal Links 回调
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
    NSString *path = userActivity.webpageURL.path;
    if ([path hasPrefix:@"/wx"]) {
        return [WXApi handleOpenUniversalLink:userActivity delegate:self];
    }
    return YES;
}

iOS 13以下还是走原来代理方法:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
    if ([url.scheme hasPrefix:@"wx"]){
        return [WXApi handleOpenURL:url delegate:self];
    }
    return YES;
}

推荐阅读更多精彩内容