little-snow-fox / react-native-wechat-lib

🚀 WeChat login, share, favorite and payment for React-Native on iOS and Android
MIT License
646 stars 126 forks source link

Android 3.0.0 和 3.0.4 版本 sendAuthRequest 请求无回调 #260

Closed tonytony2020 closed 8 months ago

tonytony2020 commented 8 months ago

按照文档设置后,在业务应用中调用 sendAuthRequest ,能拉起微信,点击授权登录后,可以回到业务应用,但 sendAuthRequest 的 promise 既没有调用 then 也没有调用 catch。

从 Android Studio IDE 看日志,Android 系统已经调用了 业务应用包名.wxapi.WXEntryActivity indent 。

相关日志,以 业务应用包名 过滤器时显示日志

2023-11-05 22:40:57.226  1663-1956  MicroMsg.S...sgImplComm 业务应用包名                     D  check signature:xxx
2023-11-05 22:40:57.227  1663-1956  MicroMsg.S...sgImplComm 业务应用包名                     D  pass
2023-11-05 22:40:57.227  1663-1956  MicroMsg.S...ApiImplV10 业务应用包名                     I  sendReq, req type = 1
2023-11-05 22:40:57.255  1663-1956  MicroMsg.S...ApiImplV10 业务应用包名                     I  getTokenFromWX token is wxfe1xxx
2023-11-05 22:40:57.261  1663-1956  MicroMsg.S...MessageAct 业务应用包名                     I  send, targetPkgName = com.tencent.mm, targetClassName = com.tencent.mm.plugin.base.stub.WXEntryActivity, launchMode = 2
2023-11-05 22:40:57.262  1663-1956  MicroMsg.S...MessageAct 业务应用包名                     I  sendUsingPendingIntent
2023-11-05 22:40:57.290  1663-1956  MicroMsg.S...MessageAct 业务应用包名                     D  send mm message, intent=Intent { flg=0x18000000 cmp=com.tencent.mm/.plugin.base.stub.WXEntryActivity (has extras) }
2023-11-05 22:40:57.290  1663-1725  MicroMsg.S...MessageAct 业务应用包名                     I  sendUsingPendingIntent onSendFinished resultCode: 0, resultData: null
2023-11-05 22:40:57.292  1663-1663  ActivityThread          业务应用包名                     W  SCHED: 业务应用包名/业务应用包名前缀.MainActivity [82, r=3456ms, a=735ms, w=19607ms]
2023-11-05 22:41:00.989  1663-1663  unknown:ReactModalHost  业务应用包名                     E  Updating existing dialog with context: 业务应用包名前缀.MainActivity@86bfe0d@141295117

WXEntryActivity 过滤器时显示日志

2023-11-05 22:40:57.401  2418-2418  RecentsImpl             com.miui.home                        W  onResumed className=com.tencent.mm.plugin.base.stub.WXEntryActivity   mIsInAnotherPro=false
2023-11-05 22:40:57.409 16134-27424 GuardService            com.miui.securitycenter.remote       I  notifyChange! preName = ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.base.stub.WXEntryActivity}; curName = ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.base.stub.UIEntryStub}
2023-11-05 22:41:00.889  1952-3319  ActivityTaskManager     system_server                        W  aInfo is null for resolve intent: Intent { flg=0x18000000 cmp=业务应用包名/.wxapi.WXEntryActivity (has extras) }
2023-11-05 22:41:00.890  1952-3319  ActivityTaskManager     system_server                        I  START u0 {flg=0x18000000 cmp=业务应用包名/.wxapi.WXEntryActivity (has extras)} from uid 10212
2023-11-05 22:41:00.898  1952-3319  ActivityTaskManager     system_server                        W  aInfo is null for resolve intent: Intent { flg=0x18000000 cmp=业务应用包名/.wxapi.WXEntryActivity (has extras) }
2023-11-05 22:41:00.898  1952-3319  ActivityTaskManager     system_server                        I  START u0 {flg=0x18000000 cmp=业务应用包名/.wxapi.WXEntryActivity (has extras)} from uid 10212
    WeChatLibModule.handleIntent(getIntent());
    finish();

问题似乎出在这里面?

环境信息 设备真机 android 10

npx react-native info

System:
  OS: Windows 10 10.0.22621
  CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  Memory: 5.14 GB / 15.67 GB
Binaries:
  Node:
    version: 18.16.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.19
    path: ~\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 8.6.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "33"
      - "33"
      - "33"
      - "34"
    Build Tools:
      - 29.0.0
      - 29.0.1
      - 29.0.2
      - 29.0.3
      - 30.0.2
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 33.0.2
      - 34.0.0
    System Images:
      - android-29 | Google APIs Intel x86 Atom
      - android-31 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-223.8836.35.2231.10811636
  Visual Studio:
    - 15.9.28307.1622 (Visual Studio Community 2017)
Languages:
  Java:
    version: 20.0.2
    path: C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 11.3.9
    wanted: ^11.3.9
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: ^0.72.6
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

只要能解决问题跑通逻辑,请有偿指导一下 :)

tonytony2020 commented 8 months ago

已经解决,包名写错了导致。