kvker大前端
kvker大前端
  • 发布:2017-03-23 09:42
  • 更新:2017-03-24 12:01
  • 阅读:1461

HBuiler 真机调试可以分享,使用 DCloud 云端打包后就不能分享了(微信好友)

分类:HBuilder

HBuiler 真机调试可以分享,使用 DCloud 云端打包后就不能分享了(微信好友)

var sharewx = null;

        function share() {  
            plus.share.getServices(function(s) {  
                //                  console.log(JSON.stringify(shares))  
                for(var i in s) {  
                    if('weixin' == s[i].id) {  
                        sharewx = s[i]  
                        break  
                    }  
                }  

                mui.toast(sharewx.authenticated)  
                if(sharewx.authenticated) {  
                    shareWeixinMessage()  
                } else {  
                    sharewx.authorize(function() {  
                        shareWeixinMessage()  
                    }, function(e) {  
                        mui.toast("认证授权失败:" + e.code + " - " + e.message)  
                    })  
                }  

            }, function(e) {  
                mui.toast("获取分享服务列表失败:" + e.message)  
            });  
        }  

        function shareWeixinMessage() {  
            sharewx.send({ title: "好友为你推荐。。。!", content: "最近发现一款 APP。。。", pictures: ["images/bg_qipei.png"], thumbs: ["images/icon_share.png"], href: "http://www.dcould.com/", extra: { scene: "WXSceneSession" } }, function() {  
                mui.toast("分享成功!")  
            }, function(e) {  
                mui.toast("分享失败。")  
            })  
        }
2017-03-23 09:42 负责人:无 分享
已邀请:
骁骑

骁骑

检查HBuider里配置的 微信分享用的appkey和你打包用的证书和包名是否匹配,如果不匹配会导致分享失败,
注意:
打包后检查生成包的签名是否和你在微信平台上申请时填写的应用签名是否一致,如果不一致必然出错

该问题目前已经被锁定, 无法添加新回复