收藏
回答

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
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
最后一次编辑于  2020-06-17
回答关注问题邀请回答
收藏

4 个回答

  • 微信技术专员-Abe
    微信技术专员-Abe
    2020-06-15

    自检函数和SendReq不要同时调用。

    2020-06-15
    有用
    回复 4
    • Raniys
      Raniys
      2020-06-16
      2020-06-16
      回复
    • Raniys
      Raniys
      2020-06-16
      我拆开单独调用了,还是报错 -25300,不过分享到微信成功了,显示(未验证应用)
      2020-06-16
      回复
    • Raniys
      Raniys
      2020-06-16
      2020-06-16
      回复
    • 小仙女的男朋友
      小仙女的男朋友
      2020-07-23
      你早说自检函数不能和sendReq同时调用啊,搞了一下午
      2020-07-23
      回复
  • Overcome
    Overcome
    2023-08-16

    有解决方案了吗

    2023-08-16
    有用
    回复 1
  • veteran
    veteran
    2021-08-27

    WechatOpenSDK在1.8.7.1之后的版本都无法通过pod更新,看了一下podsepc已经好久没更新了,除了手动引入,有什么解决方案

    2021-08-27
    有用
    回复
  • 雷俊博
    雷俊博
    2020-12-02

    1.能问下你是怎么解决这个问题的吗

    2020-12-02
    有用
    回复
登录 后发表内容
问题标签