企业微信flutter插件
import 'package:flutter_wxwork/flutter_wxwork.dart';
final _flutterWxworkPlugin = FlutterWxwork();
/// 判断是否安装企业微信
bool isInstall = await _flutterWxworkPlugin.isAppInstalled();
/// 初始化(发起授权之前需先进行初始化)
final result = await _flutterWxworkPlugin.register(scheme: 'scheme', corpId: 'corpId', agentId:'agentId');
/// 调起授权
final result = await _flutterWxworkPlugin.auth();
/// 分享
_flutterWxworkPlugin.shareText('hello world');
1.添加需要支持的白名单
ios/Runner/info.plist
增加 key:LSApplicationQueriesSchemes,添加 wxwork。
<key>LSApplicationQueriesSchemes</key>
<array>
<string>wxwork</string>
</array>
2.在XCode中,选择你的工程设置项,选中“TARGETS”一栏,在“Info”标签栏的“URL Types”添加“URL Schemes”,其内容分别为你的scheme
和corpId
。
若报错:+[NSData wwkapi_nilobj]
可打开XCode打开项目,TARGETS -> Runner -> Build Settings -> Other Linker Flags
添加
$(inherited) -ObjC -l"WXWorkApi"
android/src/main/AndroidManifest.xml
中添加 <queries>
<package android:name="com.tencent.wework" /> // 指定企业微信包名
</queries>
android/app
目录下加上 proguard-rules.pro 文件-keep class com.tencent.wework.api.** {*;}
如果对你有帮助,不吝给个start~ 谢谢佬们