React Native 包使用微信分享、登录、收藏、支付等功能,支持Android/iOS。
React Native 包使用微信分享、登录、收藏、支付等功能,支持Android/iOS。完整实例 Example | 完整的接口文档
apple-app-site-association
的文件,如下:json
{
"applinks": {
"details": [
{
"appID": "968DSZ49MT.com.uiwjs.react.example.wechat",
"paths": ["/react-native-wechat/*"]
}
]
}
}
968DSZ49MT
表示苹果账号的团队 ID
,com.uiwjs.react.example.wechat
表示项目的 BundleID
。<Application Identifier Prefix>.<Bundle Identifier>
根目录
或xxx目录
下,apple-app-site-association
文件不需要扩展名。https://<fully qualified domain>/.well-known/apple-app-site-association
根目录
https://uiwjs.github.io/apple-app-site-association
xxx目录
https://uiwjs.github.io/react-native-wechat/apple-app-site-association
Associated Domains
开关,将 Universal Links
域名加到配置上,如果 URL
地址是 https://uiwjs.github.io/apple-app-site-association,那么,Associated Domains
中填写 applinks: uiwjs.github.io
。Identifiers
里,在对应的 BundleId
下勾选 Associated Domains
> -canOpenURL: failed for URL: "weixin://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
>
ios/<应用名称>/Info.plist
中添加xml
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>weixin</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wx500b695a47bd364b</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
<string>weixinULAPI</string>
</array>
diff
+ #if RCT_DEV
+ #import <React/RCTDevLoadingView.h>
+ #endif
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
+ #if RCT_DEV
+ [bridge moduleForClass:[RCTDevLoadingView class]];
+ #endif
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"example" initialProperties:nil];
yarn add @uiw/react-native-alipay
# react-native version >= 0.60+
$ cd ios && pod install
import Wechat from '@uiw/react-native-wechat';
cd example # 进入实例 example 工程,根目录不需要安装,会引发错误
yarn install # 安装依赖
cd ios # 进入 example/ios 目录安装依赖
pod instll # 安装依赖
当前工程基于 @brodybits/create-react-native-module 初始化。
npx create-react-native-module --package-identifier com.uiwjs.react.wechat --object-class-name RNWechat --generate-example Wechat --example-react-native-version 0.63.2 --module-name @uiw/react-native-wechat --github-account uiwjs --author-name "Kenny Wong" --author-email "wowohoo@qq.com"