# react-native-wechat
**Repository Path**: ArtfulCoder/react-native-wechat
## Basic Information
- **Project Name**: react-native-wechat
- **Description**: No description available
- **Primary Language**: JavaScript
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-07-19
- **Last Updated**: 2024-07-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
[](https://npmjs.org/package/@uiw/react-native-wechat)

React Native 包使用微信分享、登录、收藏、支付等功能,支持Android/iOS。完整实例 [Example](https://github.com/uiwjs/react-native-wechat/tree/master/example) | [完整的接口文档](https://uiwjs.github.io/react-native-alipay/)
## 注意事项
iOS: 微信授权登录 Universal Link(通用链接)
> [Universal Link(通用链接)](https://developer.apple.com/documentation/safariservices/supporting_associated_domains)是苹果在 iOS9 推出的,一种能够方便的通过传统 HTTPS 链接来启动 APP 的功能,可以使用相同的网址打开网址和 APP。
> 看起来就是一条普通的 https 链接,当然是我们在该链接域名根目录配置过的一个链接,也可以在该链接中放置对应的H5页面。当用户的点击该链接,只要手机中安装了支持该链接的 APP 就会直接进入到 APP 中。如果没有安装APP则会跳转到 Safari 浏览器中,展示 H5 页面。对用户来说则是一个无缝跳转的过程。
创建一个名为 `apple-app-site-association` 的文件,如下:
```json
{
"applinks": {
"details": [
{
"appID": "968DSZ49MT.com.uiwjs.react.example.wechat",
"paths": ["/react-native-wechat/*"]
}
]
}
}
```
**说明:** 字段 appID 中的 `968DSZ49MT` 表示苹果账号的团队 `ID`,`com.uiwjs.react.example.wechat` 表示项目的 `BundleID`。
```
登录苹果开发者后台,在设置证书的页面找到 `Identifiers` 里,在对应的 `BundleId` 下勾选 `Associated Domains`
iOS: -canOpenURL: failed for URL: "weixin://".
> ```
> -canOpenURL: failed for URL: "weixin://" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
> ```
设置 URL Schemes 并列为白名单,在 [`ios/<应用名称>/Info.plist`](https://github.com/uiwjs/react-native-wechat/blob/f6caea5b7d58dd05b7fc110ff76295c5e2be927b/example/ios/example/Info.plist#L23-L43) 中添加
```xml
iOS: RCTBridge required dispatch_sync to load RCTDevLoadingView.
> 错误内容: RCTBridge required dispatch_sync to load RCTDevLoadingView. This may lead to deadlocks
**错误解决方案**:可以通过下面代码可以解决,事实上我通过关闭 debug 浏览器页面就没有错误消息了。错误原因可能是你打开了 debug 浏览器,但是你模拟器并没有开启 debug 模式。
```diff
+ #if RCT_DEV
+ #import