收藏
回答

WXLog:Error:set token fail, errCode:4, errLog:wx?

API名称:WXApi sendAuthReq,微信版本:8.0.46,基础库版本:微信OpenSDK 2.0.2, 移动应用(APP)做微信登录

目前实现情况:点击微信登录,可以调起微信,确认之后,监听函数没有收到结果

注册WxApi成功,调用WXApi sendAuthReq(scope, state, nonAutomatic), 有几个log, 最后出错

2024-02-20 20:25:28.045204+0800 PTNS[600:63586] [WeChatIdentityHandler.mm]-[WeChatIdentityHandler checkAndRecordTokenToKeychain:contextID:error:]WXLog:Error:set token fail, errCode:4, errLog:wx token[] or contextId[(null)] is nil!

详细些的log是这样:

2024-02-20 20:25:26.987210+0800 PTNS[600:63586] [WXApi.m]+[WXApi sendReq:isAutoResend:forceScheme:completion:]WXLog:send req[<SendAuthReq: 0x2803bd080>], appID:wx86c*******, universalLink:https://******/, sdkVersion:2.0.2

2024-02-20 20:25:26.997210+0800 PTNS[600:63586] [WXApi.m]+[WXApi sendReq:isAutoResend:forceScheme:completion:]WXLog:send req transformToUrl data len:244, erased:0

2024-02-20 20:25:26.997398+0800 PTNS[600:63586] [WXApi.m]+[WXApi sendReq:isAutoResend:forceScheme:completion:]WXLog:gen url with full params ok

2024-02-20 20:25:27.183292+0800 PTNS[600:63586] [WXApi.m]+[WXApi launchApplicationWithUrl:completion:]_block_invokeWXLog:launch app with ul only success

2024-02-20 20:25:27.183469+0800 PTNS[600:63586] [WXApi.m]+[WXApi launchWechatWithExtralUrl:forceScheme:contextId:paramsDataStr:unnecessaryDataErased:completion:]_block_invokeWXLog:launch app with universal link, ret:1

2024-02-20 20:25:27.183620+0800 PTNS[600:63586] [WeChatIdentityHandler.mm]-[WeChatIdentityHandler setContextReq:contextId:]WXLog:req:<SendAuthReq: 0x2803bd080>, cid:ec3113dcfdb3d6f4b197adfdb5c63cfb4a0ac4b986c0e4ab1368c295b5675ce9

2024-02-20 20:25:27.936097+0800 PTNS[600:63586] -[SceneDelegate sceneDidEnterBackground:](56):scene background

2024-02-20 20:25:27.943237+0800 PTNS[600:63586] <MainViewController: 0x130831000> #applicationWillEnterForeground or Will Terminate or applicationWillResignActive

2024-02-20 20:25:27.946337+0800 PTNS[600:63586] <MainViewController: 0x130831000> #applicationWillEnterForeground or Will Terminate or applicationWillResignActive

2024-02-20 20:25:28.026240+0800 PTNS[600:63936] [Common] Snapshot request 0x281816c70 complete with error: <NSError: 0x281820ba0; domain: FBSSceneSnapshotErrorDomain; code: 3; reason: "the request was canceled">

2024-02-20 20:25:28.029082+0800 PTNS[600:63959] [Common] Snapshot request 0x281881b90 complete with error: <NSError: 0x281894c90; domain: BSActionErrorDomain; code: 6 (anulled)>

2024-02-20 20:25:28.037997+0800 PTNS[600:63586] -[SceneDelegate sceneWillEnterForeground:](43):scene foreground

2024-02-20 20:25:28.045204+0800 PTNS[600:63586] [WeChatIdentityHandler.mm]-[WeChatIdentityHandler checkAndRecordTokenToKeychain:contextID:error:]WXLog:Error:set token fail, errCode:4, errLog:wx token[] or contextId[(null)] is nil!

按照文档说明已验证universalLink可以正常工作。

请问最后这个出错可能是什么原因?


回答关注问题邀请回答
收藏

1 个回答

  • 我是DJ
    我是DJ
    08-26

    我也是同样的问题,解决了吗?

    08-26
    有用
    回复 1
    • 我是DJ
      我是DJ
      08-26
      解决了,把代理方法onResp和onReq放到AppDelegate下面就可以了。之前是放在自己封装的类里面 然而open url 逻辑根本就没走。
      08-26
      回复
登录 后发表内容