fluwx icon indicating copy to clipboard operation
fluwx copied to clipboard

4.4.9 微信登录 Android 收得到回调 IOS却不能

Open ahkela21 opened this issue 1 year ago • 1 comments

Describe the bug 如题,想请问会是哪里出了问题 造成这样的情况呢?已经完成封装

Future<WechatService> init() async {
    _fluwx = Fluwx();
    await _fluwx.registerApi(
      appId: Env.wechatAppId,
      doOnAndroid: true,
      doOnIOS: true,
      universalLink: 'https://bluente.link/',
    );
    isWeChatInstalled = await _fluwx.isWeChatInstalled;
    listenAuthResponse();
    return this;
  }

  void listenAuthResponse() {
    _fluwx.addSubscriber((response) async {
      if (response is WeChatAuthResponse) {
        bool authSuccess = wechatAuthResponseHandler(response);
        if (authSuccess) {
          if (response.code != null) {
            await wechatLogin(response.code!);
          } else {
            SnackBarUtils.showSnackBar(
              AppStrings.somethingWentWrong.tr,
              state: SnackBarState.error,
            );
          }
        }
      }

      if (response is WeChatPaymentResponse) {
        if (response.isSuccessful) {
          if (Get.isRegistered<SubscriptionScreenController>()) {
            Get.find<SubscriptionScreenController>().paymentSuccessRedirect();
          }
        }
      }
    });
  }
  
 Future<void> signInWithWeChat() async {
    await _fluwx.authBy(
        which: NormalAuth(
      scope: 'snsapi_userinfo',
      state: 'wechat_sdk_demo',
    ));
  }

FluwxLog

flutter: FluwxLog: [WXApi.m]+[WXApi sendReq:isAutoResend:forceScheme:completion:]WXLog:send req[<SendAuthReq: 0x280a04580>], appID: ..., universalLink:https://example.link/, sdkVersion:2.0.2
flutter: FluwxLog: [WXApi.m]+[WXApi sendReq:isAutoResend:forceScheme:completion:]WXLog:send req transformToUrl data len:224, erased:0
flutter: FluwxLog: [WXApi.m]+[WXApi sendReq:isAutoResend:forceScheme:completion:]WXLog:gen url with full params ok
flutter: FluwxLog: [WXApi.m]+[WXApi launchApplicationWithUrl:completion:]_block_invokeWXLog:launch app with ul only success
flutter: FluwxLog: [WXApi.m]+[WXApi launchWechatWithExtralUrl:forceScheme:contextId:paramsDataStr:unnecessaryDataErased:completion:]_block_invokeWXLog:launch app with universal link, ret:1
flutter: FluwxLog: [WeChatIdentityHandler.mm]-[WeChatIdentityHandler setContextReq:contextId:]WXLog:req:<SendAuthReq: 0x280a04580>, cid:b0696d6bc2765d86daaf5456dadc7e0764dbaf49013d4e19134d80164de9cf6d

Which version of Fluwx do you use? 4.4.9

Which device do you run on iPhone 12 Pro Max, 17.3.1

Which Flutter do you use? 3.19.0

ahkela21 avatar Feb 21 '24 05:02 ahkela21

可能是有别的插件影响到了微信回调

JarvanMo avatar Feb 21 '24 06:02 JarvanMo