RxReader / wechat_kit

Flutter版微信登录/分享/支付 SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1.1.0版本,按照示例做了,就是WECHAT_UNIVERSAL_LINK用了微信提供的测试连接,调起api没反应,不知道下一步该如何调试了,请指教!!!

MrNew opened this issue · comments

commented

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:wechat_kit/wechat_kit.dart';

const String WECHAT_APPID = ''; //这里先删掉,是有正确填写的
const String WECHAT_UNIVERSAL_LINK = 'https://help.wechat.com/app/'; // iOS 请配置
const String WECHAT_MINIAPPID = 'your wechat miniAppId';

class SearchPage extends StatefulWidget{
@OverRide
_SearchPageState createState() {
return _SearchPageState();
}
}

class _SearchPageState extends State{

Wechat _wechat = Wechat()
..registerApp(
appId: WECHAT_APPID,
universalLink: WECHAT_UNIVERSAL_LINK,
);

StreamSubscription _auth;
WechatAuthResp _authResp;

@OverRide
void initState() {
super.initState();

print('sdfa12121231231');
print(WECHAT_APPID);
print(WECHAT_UNIVERSAL_LINK);

_auth = _wechat.authResp().listen(_listenAuth);
_wechat.authFinishResp().listen(_listenAuthend);
print(_wechat);

}

@OverRide
void dispose() {
if (_auth != null) {
_auth.cancel();
}
super.dispose();
}

void _listenAuth(WechatAuthResp resp) {
print('_listenAuth');
_authResp = resp;
String content = 'auth: ${resp.errorCode} ${resp.errorMsg}';
print(content);
print(resp);
print('_listenAuth_end');
}

void _listenAuthend(WechatQrauthResp resp) {
print('_listenAuth');
print('resp: ${resp.errorCode} - ${resp.authCode}');
print('_listenAuth_end');
}

@OverRide
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: GestureDetector(
onTap: () {
print('sdfa12121231231');
print(_wechat);
_wechat.auth(
scope: [WechatScope.SNSAPI_USERINFO],
state: 'auth',
);

        print('ssdfsdf');
      },
      child: Text("登录"),
    )
  ),
);

}
}

点击按钮的控制台打印一下内容:
2020-07-07 20:47:09.676373+0800 Runner[7530:1205731] flutter: sdfa12121231231
2020-07-07 20:47:09.677196+0800 Runner[7530:1205731] flutter: Instance of 'Wechat'
2020-07-07 20:47:09.679181+0800 Runner[7530:1205731] flutter: ssdfsdf

commented

这个是用微信平台提供的测试link,不知道是不是用了这个的问题,我接着配置来试试
const String WECHAT_UNIVERSAL_LINK = 'https://help.wechat.com/app/'; // iOS 请配置

WECHAT_UNIVERSAL_LINK 请配置自己的

commented

我的Apple ID还没开开发者权限,开不了Associated Domains这个功能,没法配置微信的测试link,感觉更可能是这个原因,😢