react-native-wechat 微信支付时候直接闪退app

来源:15-11 RN App社会化分享、第三方登录开发精讲-2【必备加分技能】

迎风向上乀

2019-01-28

现在是按照这样的配置

WeChat.isWXAppInstalled()
                                            .then((isInstalled) => {                                                   if (isInstalled) {
                                                        WeChat.pay({
                                                            partnerId: 'xxxxxx',  // 商家向财付通申请的商家id
                                                            prepayId: 'xxxxxx',   // 预支付订单
                                                            nonceStr:'xxxxxx',   // 随机串,防重发
                                                            timeStamp: 'xxxxxxx'    ,  // 时间戳,防重发.
                                                            package: 'Sign=WXPay',    // 商家根据财付通文档填写的数据和签名
                                                            sign: 'xxxxxxxxx'       // 商家根据微信开放平台文档对数据做的签名
                                                            }).then((requestJson)=>{                                                                      //支付成功回调                                           
                                                                      if (requestJson.errCode=="0"){                                                                       //回调成功处理
                                                                      }
                                                                  }).catch((err)=>{
                                                                      Alert.alert('支付失败')
                                                                  })
                                                    } else {
                                                        Alert.alert('请安装微信');
                                                    }
                                             });

但是会出现app直接闪退 微信也没打开的局面。

是因为要安装微信的SDK吗? 老师有微信支付的笔记分享吗。

写回答

1回答

CrazyCodeBoy

2019-01-28

建议:看下crash log,根据具体的报错信息进行修改;

另外,也可在https://github.com/yorkie/react-native-wechat/issues上提个issue,看下有没有用户遇到类似的问题。

0
0

RN入门到进阶,打造高质量上线App

解锁React Native开发应用新姿势,React Native新版本热门技术

3144 学习 · 3241 问题

查看课程