WechatOpenSDK (1.8.7.1) 报错:-25300
复现步骤:
一 cocoapods 安装 open sdk,版本 1.8.7.1:
pod 'WechatOpenSDK'
二 在 Info.plist 配置 Schema 以及 URL Types 中配置 微信 appId:
三 AppDelegate 注册 WXApi 及实现 WXApiDelegate:
[@UIApplicationMain](/user/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](/user/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: ]
"
该如何解决呢?
微信号:kid17-test 微信日志已上传,时间 2020-06-11 19:44
1 回复
调用
+ (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[<SendMessageToWXReq: 0x280895b00>], 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:<SendMessageToWXReq: 0x280895b00>, cid:xxxxxxxxxxxxxxxxxxxxx
WXApi.send isOk: true