首页 > 开发 > php > 正文

微信jssdk ios微信内部自定义分享失效,安卓正常

2017-09-06 13:38:07  来源:网友分享

微信内部分享onMenuShareTimeline、onMenuShareAppMessage在ios系统中自定义内容出不来,安卓分享是没有问题的,这是怎么回事儿?
代码如下:

<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script><script>      wx.config({          debug: false,          appId: '<?php echo $signPackage["appid"];?>',          timestamp: '<?php echo $signPackage["timestamp"];?>',          nonceStr: '<?php echo $signPackage["noncestr"];?>',          signature: '<?php echo $signPackage["signature"];?>',          jsApiList: [              'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'hideAllNonBaseMenuItem'          ]      });</script><script>      {if !empty($share_data)}      wx.ready(function () {                        // 在这里调用 API          wx.onMenuShareTimeline({              title: '<?php echo $share_data["title"];?>', // 分享标题              desc: '<?php echo $share_data["desc"];?>', // 分享描述              link: '<?php echo $share_data["url"];?>', // 分享链接              imgUrl: '<?php echo $share_data["imgurl"];?>', // 分享图标              success: function () {//                if (share_success != undefined) {                  share_success();//                }              },              cancel: function () {//                if (share_cancel != undefined) {                  share_cancel();//                }              }          });          wx.onMenuShareAppMessage({              title: '<?php echo $share_data["title"];?>', // 分享标题              desc: '<?php echo $share_data["desc"];?>', // 分享描述              link: '<?php echo $share_data["url"];?>', // 分享链接              imgUrl: '<?php echo $share_data["imgurl"];?>', // 分享图标              type: 'link', // 分享类型,music、video或link,不填默认为link              dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空              success: function () {//                if (share_success != undefined) {                  share_success();//                }              },              cancel: function () {//                if (share_cancel != undefined) {                  share_cancel();//                }              }          });          wx.onMenuShareQQ({              title: '<?php echo $share_data["title"];?>', // 分享标题              desc: '<?php echo $share_data["desc"];?>', // 分享描述              link: '<?php echo $share_data["url"];?>', // 分享链接              imgUrl: '<?php echo $share_data["imgurl"];?>', // 分享图标              type: 'link', // 分享类型,music、video或link,不填默认为link              dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空              success: function () {//                if (share_success != undefined) {                  share_success();//                }              },              cancel: function () {//                if (share_cancel != undefined) {                  share_cancel();//                }              }          });      });      wx.error(function (res) {//        alert(res.errMsg);      });      {else}      wx.ready(function () {          wx.hideAllNonBaseMenuItem();      });      {/if}</script>

解决方案

解决了,link带的url是要带http的地址,现在我改成window.location.href,ios正常了