javascript - WeChat jssdk ios customized onMenuShareAppMessage sharing fails, Android sharing is successful
伊谢尔伦
伊谢尔伦 2017-05-17 10:00:30
0
2
598

When sharing and calling the onMenuShareAppMessage method under Android, the custom link is successfully used, but the same code is still a link to this page under ios. When debug mode is turned on, everything is ok, and ios is also ok. I don’t know what the problem is. What's wrong, it's also called in wx.ready, and even settingTimeout for two seconds didn't work. I tried everything.

setTimeout(function() {
                    alert('已注册获取“发送给朋友”状态事件');
                    // 分享到朋友圈
                    wx.onMenuShareAppMessage({
                        title: '个人资料', // 分享标题
                        desc: '他(她)的病症信息。', // 分享描述
                        link: '<%=basePath%>/weChat/more/sharePage?'+queryString, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
                        imgUrl: '<%=basePath%>/images/weChat/ic_share.png', // 分享图标
                        type: 'link',
                        trigger: function (res) {
                            alert('用户点击发送给朋友');
                        },
                        success: function (res) {
                           alert('已分享');
                        },
                        cancel: function (res) {
                           alert('已取消');
                        },
                        fail: function (res) {
                           alert(JSON.stringify(res));
                        }
                    });
                 }, 2000);
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
我想大声告诉你

Finally solved the problem, I changed the variables <%=basePath%> in link and imgUrl to fixed paths, and it’s easy to use

过去多啦不再A梦

link should be consistent with the safe domain name. I don’t know how your basePath is

https://mp.weixin.qq.com/wiki

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template