中文请移步此处
Fluwx
是微信SDK的flutter插件,允许开发者调用
微信SDK原生API。
立即加入QQ群:1003811176
立即迁移到 V4
重大变更: Fluwx从 4.5.0 开始不再请求权限(WRITE_EXTERNAL_STORAGE)。这意味着如果不支持 FileProvider,您在共享图像时将需要处理权限。
Fluwx
很好,但不是上帝。在集成Fluwx
之前最好先阅读官方文档。然后您将了解如何生成 Android 签名、什么是 iOS 通用链接、如何添加 iOS 的 URL 架构等等。
在pubspec.yaml
文件中添加以下依赖项:
Fluwx
带薪:
dependencies :
fluwx : ^${latestVersion}
Fluwx
无薪:
需要排除 iOS 支付的开发者可以在 pubspec.yaml 中启用
no_pay
。
注意:永远不要忘记将 ^${latestVersion} 替换为实际版本。
Fluwx
在 v4 的pubspec.yaml
的fluwx
部分中启用了多种配置,您可以参考 pubspec.yaml 了解更多详细信息。
对于iOS,一些配置,如url_scheme,universal_link,LSApplicationQueriesSchemes,可以通过
fluwx
配置,你需要做的就是在pubspec.yaml
中填写配置
应用程序 ID。推荐。它将用于在 iOS 上生成方案。这不是用于初始化微信 SDK,因此您仍然需要手动调用fluwx.registerApi
。
调试_日志记录。选修的。通过将其设置为true
来启用日志。
颤振活动。选修的。这通常用于Android上微信冷启动。如果未设置, Fluwx
将尝试启动启动器活动。
通用链接。推荐用于 iOS。它将用于在您的项目上生成通用链接。
scene_delegate。选修的。使用AppDelegate
或SceneDelegate
。更多详情请参阅官方文档。
对于 iOS 如果您在 iOS 上cannot load such file -- plist
失败,请执行以下步骤:
# step.1 install missing dependencies
sudo gem install plist
# step.2 enter iOS folder(example/ios/,ios/)
cd example/ios/
# step.3 execute
pod install
{
"module" : {
"querySchemes" : [
"weixin"
] ,
}
}
如有必要,通过fluwx
注册您的应用程序。
Fluwx fluwx = Fluwx ();
fluwx. registerApi (appId : "wxd930ea5d5a228f5f" ,universalLink : "https://your.univerallink.com/link/" );
参数universalLink
仅适用于 iOS。您可以阅读此文档来了解如何创建universalLink。您还可以了解如何添加 URL 架构、如何在 iOS 项目中添加LSApplicationQueriesSchemes
。这是至关重要的。
对于 Android,您应该在此页面了解如何为您的应用程序生成签名。并且您必须了解调试签名和发布签名之间的区别。一旦签名不正确,您将得到errCode = -1
。
最好尽早注册您的 API。
更多功能可以阅读fluwx
的公共函数。
这些问题也许有帮助
请作家喝杯咖啡。
Copyright 2023 OpenFlutter Project
Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for
additional information regarding copyright ownership. The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.