复现步骤:
一 cocoapods 安装 open sdk,版本 1.8.7.1:
pod 'WechatOpenSDK'
二 在 Info.plist 配置 Schema 以及 URL Types 中配置 微信 appId:
三 AppDelegate 注册 WXApi 及实现 WXApiDelegate:
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// WechatOpenSDK
WXApi.startLog(by: .detail) { (msg) in
print("WXApi log: \(msg)")
}
// 已使用 safari 验证 "https://sub.domain.com/link" 可以正常调起 app
WXApi.registerApp(Configs.WeChat.appID, universalLink: "https://sub.domain.com/link")
print("WXApi version: \(WXApi.getVersion())")
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return WXApi.handleOpen(url, delegate: self)
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
return WXApi.handleOpenUniversalLink(userActivity, delegate: self)
}
}
extension AppDelegate: WXApiDelegate {
// wechat delegate
func onReq(_ req: BaseReq) {
print("wechat onReq \(req.debugDescription)")
}
func onResp(_ resp: BaseResp) {
print("wechat onResp \(resp.debugDescription)")
}
}
四 在 ViewController 调用 WXApi 的 方法:
+ (void)sendReq:(BaseReq *)req completion:(void (^ __nullable)(BOOL success))completion;
五 结果如下:
回调值 userActivity.webpageURL:
"https://sub.domain.com/link/wxxxxxxx/refreshToken?wechat_auth_token=xxxx&wechat_auth_context_id=TestAutoCheckContextId_xxxxxx"
Log 记录:
"
WXApi log: wxlog:set property list
WXApi log: wxlog:send req[], appID:wxxxxxxxx, universalLink:https://sub.domain.com/link/, sdkVersion:1.8.7.1
WXApi log: wxlog:set property list
WXApi log: wxlog:Error:fail to load Keychain status:-25300, keyData null:1
WXApi log: wxlog:token[(null)] is null
WXApi log: wxlog:launch app with ul only success
WXApi log: wxlog:Successfully starting WeChat with the universal link.
WXApi log: wxlog:launch app with ul only success
WXApi log: wxlog:launch app with universal link, ret:1
WXApi log: wxlog:req:, cid:xxxxxxxxxx
WXApi.send isOk: true
WXApi log: wxlog:WXCheckULStepResult[success: 1, errorInfo: Universal Link check passed. The application is launched by WeChat via Universal Link, suggestion: ]
WXApi log: wxlog:WXCheckULStepResult[success: 1, errorInfo: All Check Passed!, suggestion: ]
"
调用
+ (void)checkUniversalLinkReady:(nonnull WXCheckULCompletion)completion;
checkUniversalLinkReady: step 0, success true, errorInfo check passed, suggestion
checkUniversalLinkReady: step 1, success true, errorInfo check passed, suggestion
checkUniversalLinkReady: step 2, success true, errorInfo check passed, suggestion
WXApi log: wxlog:set property list
checkUniversalLinkReady: step 3, success true, errorInfo check passed, suggestion
WXApi log: wxlog:send req[], appID:wx04155bc44c349cd2, universalLink:https://guardian.kid17.com/link/, sdkVersion:1.8.7.1
WXApi log: wxlog:set property list
WXApi log: wxlog:Error:fail to load Keychain status:-25300, keyData null:1
WXApi log: wxlog:token[(null)] is null
WXApi log: wxlog:launch app with ul only success
checkUniversalLinkReady: step 4, success true, errorInfo check passed, suggestion
WXApi log: wxlog:Successfully starting WeChat with the universal link.
WXApi log: wxlog:launch app with ul only success
WXApi log: wxlog:launch app with universal link, ret:1
WXApi log: wxlog:req:, cid:xxxxxxxxxxxxxxxxxxxxx
WXApi.send isOk: true
该如何解决呢?
微信号:kid17-test 微信日志已上传,时间 2020-06-11 19:44
自检函数和SendReq不要同时调用。
checkUniversalLinkReady: step 0, success true, errorInfo check passed, suggestion
checkUniversalLinkReady: step 1, success true, errorInfo check passed, suggestion
checkUniversalLinkReady: step 2, success true, errorInfo check passed, suggestion
checkUniversalLinkReady: step 3, success true, errorInfo check passed, suggestion
checkUniversalLinkReady: step 4, success true, errorInfo check passed, suggestion
checkUniversalLinkReady: step 5, success true, errorInfo Universal Link check passed. The application is launched by WeChat via Universal Link, suggestion
checkUniversalLinkReady: step 6, success true, errorInfo All Check Passed!, suggestion
WXApi log: wxlog:send req[<SendMessageToWXReq: 0x280fe5cc0>], appID:wx04155bc44c349cd2, universalLink:https://sub.domain.com/link/, sdkVersion:1.8.7.1
WXApi log: wxlog:set property list
WXApi log: wxlog:Error:fail to load Keychain status:-25300, keyData null:1
WXApi log: wxlog:token[(null)] is null
WXApi log: wxlog:launch app with ul only success
WXApi log: wxlog:launch app with universal link, ret:1
WXApi log: wxlog:req:<SendMessageToWXReq: 0x280fe5cc0>, cid:xxxxxxxxx
WXApi log: wxlog:Error:fail to delete Keychain before add status:-25300
WXApi log: wxlog:token sha1:xxxxxxxx
WXApi log: wxlog:clear context
WXApi log: wxlog:context req:<SendMessageToWXReq: 0x280fe5cc0>
WXApi log: wxlog:send req[<SendMessageToWXReq: 0x280fe5cc0>], appID:wx04155bc44c349cd2, universalLink:https://sub.domain.com/link/, sdkVersion:1.8.7.1
WXApi log: wxlog:set property list
WXApi log: wxlog:launch app with ul only success
WXApi log: wxlog:launch app with universal link, ret:1
有解决方案了吗
这里能解决你的问题!!!
WechatOpenSDK在1.8.7.1之后的版本都无法通过pod更新,看了一下podsepc已经好久没更新了,除了手动引入,有什么解决方案
1.能问下你是怎么解决这个问题的吗