Home  >  Article  >  Backend Development  >  微信JS-sdk分享到朋友圈无效

微信JS-sdk分享到朋友圈无效

WBOY
WBOYOriginal
2016-06-06 20:37:561212browse

代码如下:

<code>wx.ready(function(){
    wx.onMenuShareTimeline({
          title: 'wechat-php-sdk博客',
          desc: '微信公众平台php开发包,细化各项接口操作,支持链式调用。项目创建人:dodgepudding 项目地址:https://github.com/dodgepudding/wechat-php-sdk',
          link: 'http://binsee.github.io/wechat-php-sdk/',
          imgUrl: 'http://binsee.github.io/wechat-php-sdk/img/author.jpg',
          trigger: function (res) {
                alert("点击分享:" +JSON.stringify(res));
                // 用户确认分享后执行的回调函数
            },
            success: function (res) {
                alert("分享成功:" +JSON.stringify(res));
                // 用户确认分享后执行的回调函数
            },
            cancel: function (res) {
                alert("取消分享:" +JSON.stringify(res));
                // 用户取消分享后执行的回调函数
            },
            fail:function (res) {
                alert("分享失败:" +JSON.stringify(res));
            }
        });
});
</code>

其他接口测试了都能用的,就这个发送给朋友及分享到朋友圈无效。。
本人测试环境IOS8.1 , 微信版本6.02 ,
同样的网址用同事的手机(IOS6)分享是能成功触发的。自己的手机调试了半天了就是不行。。。
有人遇到过类似的情况吗。

回复内容:

代码如下:

<code>wx.ready(function(){
    wx.onMenuShareTimeline({
          title: 'wechat-php-sdk博客',
          desc: '微信公众平台php开发包,细化各项接口操作,支持链式调用。项目创建人:dodgepudding 项目地址:https://github.com/dodgepudding/wechat-php-sdk',
          link: 'http://binsee.github.io/wechat-php-sdk/',
          imgUrl: 'http://binsee.github.io/wechat-php-sdk/img/author.jpg',
          trigger: function (res) {
                alert("点击分享:" +JSON.stringify(res));
                // 用户确认分享后执行的回调函数
            },
            success: function (res) {
                alert("分享成功:" +JSON.stringify(res));
                // 用户确认分享后执行的回调函数
            },
            cancel: function (res) {
                alert("取消分享:" +JSON.stringify(res));
                // 用户取消分享后执行的回调函数
            },
            fail:function (res) {
                alert("分享失败:" +JSON.stringify(res));
            }
        });
});
</code>

其他接口测试了都能用的,就这个发送给朋友及分享到朋友圈无效。。
本人测试环境IOS8.1 , 微信版本6.02 ,
同样的网址用同事的手机(IOS6)分享是能成功触发的。自己的手机调试了半天了就是不行。。。
有人遇到过类似的情况吗。

1,确定你已经认证,后台显示拥有相关权限

2,确定你已经在后台设置安全域名

3,https://github.com/wjfz/weixin-jssdk用这个demo试试,排除设备原因

嗯,lz的号没认证
只有认证的号才能分享。

https://github.com/dodgepudding/wechat-php-sdk/tree/master/test/jsapi 我是用这个代码测试的,其他的接口都能使用,就分享那几个不能用。。 还有我的微信号是没认证的,一定要认证才行嘛?

如果你的用的安卓版的微信,请看一下你的微信版本。。。
如果是6.0.2.57或者以前的版,貌似不支持最新发布的js-sdk只有6.0.2.58才支持
如果是IOS系统的微信,貌似我6.0.1的版本的微信,就可以用

打开debug模式查看提示信息啊。

另外:安卓6.0.2之前的版本和6.0.2.58之后的版本可以使用,你要是安卓和ios都无法使用分享功能那就还是你的配置什么地方还有问题。

可参考此方法:http://www.huceo.com/post/414.html

和楼主的代码一样,微信服务器已经认证。分享的时候显示的只是网页的标题,并不是设置好的个性化分享内容。求指导

我也遇到这个问题了,不知道怎么解决

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn