Hector-Chong / native-wechat

A React Native library for supporting Wechat APIs on Android and iOS

Home Page:https://native-wechat.hector.im

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

isWechatInstalled 返回值是undefined

meiqi1992 opened this issue · comments

let wechatIsInstal = await isWechatInstalled()

我打印wechatIsInstal 结果是undefined,但是我看原生代码这里是yes
image

isWechatInstalled 返回的是一个 Pending 状态的 Promise。

当 Promise 被 Resolved 时,意味着微信已安装,否则未安装并且你应该在这里使用 try...catch 包裹 await

isWechatInstalled returns a pending promise.

When the promise is resolved, it means WeChat is installed on your device. Otherwise, it doesn't and you should wrap the await with try...catch here.

好的,谢谢,还有个问题就是我的分享图片有的会比较大,可以做个压缩处理吗?类似这样
https://github.com/little-snow-fox/react-native-wechat-lib/blob/master/ios/RCTWeChat.m#L65

没有问题,我会在下一个版本为这个功能提供支持。

No problem. This feature will be delivered in the next version.

赞👍

Android 碰到的问题

1、isWechatInstalled 不管手机有没有装微信都是走到catch
image

2、分享图片有的会比较大,拉不起微信,分享不成功

3、微信支付,拉不起微信,try...catch都不执行,ios上支付没问题,我看了下是由于android支付信息要传package,ios不用,建议可以两端都做个统一哈
image
image

感谢你的反馈,我会尽快处理。

Thank you for your feedback. The above will be fixed asap.

https://github.com/Hector-Chong/native-wechat/blob/main/src/hooks.ts

try catch
await
then

任何方式,都是undefined。

请勿关闭该issue。