微信分享,由于应用universal link校验不通过,无法完成分享?
发布于 7 年前 作者 lifeng 2356 次浏览 来自 问答

我之前申请appid的时候是填写的以前用过的universal links链接,没有配置apple-app-site-association,访问也是500错误,申请下来后,分享一切正常。后面我想改掉universal links并配置了apple-app-site-association,并且通过safari打开universal links地址,可以成功跳转到app。但是一直提示由于应用universal link校验不通过。

已经完成的自检:

1、已经配置好了apple-app-site-association文件并且能访问成功

2、通过Safari可以打开app

3、配置了Associated Domains

4、微信开放平台填写的universal links地址和WXApi.registerApp传入的universalLink一致

我通过SDK提供的API检测:

WXApi.startLog(by: WXLogLevel.detail) { (message) in
  console("wxapi:\(message)")
}

// 日志
wxapi:wxlog:set property list
wxapi:wxlog:launch app with ul only success
wxapi:wxlog:Successfully starting WeChat with the universal link.
wxapi:wxlog:Error:universal link check enable but contextId is error., contextID:(null)
wxapi:wxlog:clear property list
wxapi:wxlog:command:2020

WXApi.registerApp(WX_APP_ID, universalLink: UNIVERSAL_LINK)
WXApi.checkUniversalLinkReady { (setp, result) in
  console("setp:\(setp.rawValue), success:\(result.success), errorInfo:\(result.errorInfo), suggestion:\(result.suggestion)")
}

// 只执行了5个步骤,全是返回true
setp:0, success:true, errorInfo:check passed, suggestion:
setp:1, success:true, errorInfo:check passed, suggestion:
setp:2, success:true, errorInfo:check passed, suggestion:
setp:3, success:true, errorInfo:check passed, suggestion:
setp:4, success:true, errorInfo:check passed, suggestion: 

// 跳转微信错误提示:
PBItemCollectionServicer connection disconnected.

// 重写了回调方法
extension AppDelegate: WXApiDelegate {
    func application(_ application: UIApplication, handleOpen url: URL) -> Bool {
        return WXApi.handleOpen(url, delegate: self)
    }

    func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
        return WXApi.handleOpen(url, delegate: self)
    }

    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: [@escaping](/user/escaping) ([UIUserActivityRestoring]?) -> Void) -> Bool {
        return WXApi.handleOpenUniversalLink(userActivity, delegate: self)
    }

    func onReq(_ req: BaseReq) {
        console("onReq:\(req)")
    }

    func onResp(_ resp: BaseResp) {
        console("onResp:\(resp)")
    }
}

求大佬们看看这是啥原因,难道是注册appid后,再也无法修改universal links了吗?

1 回复

你好,检查下检查一下调用registerApp接口的appid和universal link在微信开放平台是否已经进行绑定,也参考下:

  1. App更新微信1.8.6.1版本SDK后出现“正在连接”的提示?
  2. Universal Link校验不通过/接入新SDK,跳到微信后再回跳App,流程就中止?


回到顶部