android微信自定义分享,微信自定义分享,在开发者工具和安卓正常,ios端错误怎么解决?...

微信自定义分享,在开发者工具和安卓端可以正常分享,在ios手机上标题描述和链接图片显示不对,打开debug弹出invalid signature,在开发者工具显示ok

我获取签名方式如下

_this.sharewx = function(){

var url = _this.HOST + '/data/getJDKSign';

var dataJson = {url:window.location.href}

_this.$post(url,dataJson)

.then((res) => {

console.log(res)

_this.appId = res.data.appId;

_this.timestamp = res.data.timestamp;

_this.nonceStr = res.data.nonceStr;

_this.signature = res.data.signature;

_this.whatshar();

})

}

调用方法:

clickshare(){

this.title = this.$emit('id').title;

this.desc = this.$emit('id').desc;

this.imgUrl = this.$emit('id').imgUrl;

this.link = this.$emit('id').link;

this.sharewx();

},

whatshar(){

var _this = this;

if(this.$emit('id').urlshare){

this.link = this.$emit('id').urlshare;

}else{

this.link = this.$emit('id').link;

}

wx.config({

debug: false,

appId: _this.appId,

timestamp: _this.timestamp,

nonceStr: _this.nonceStr,

signature: _this.signature,

jsApiList: ['onMenuShareAppMessage','onMenuShareTimeline']

});

wx.ready(function(){

wx.onMenuShareAppMessage({

title: _this.title, // 分享标题

desc: _this.desc, // 分享描述

link: _this.link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致

imgUrl: _this.imgUrl, // 分享图标

dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空

success: function () {

_this.sharebg = false;

Toast.fail({duration: 1500,message: '分享成功',type: 'text'})

},

cancel: function () {

_this.sharebg = false;

Toast.fail({duration: 1500,message: '取消分享',type: 'text'})

}

});

wx.onMenuShareTimeline({

title: _this.title, // 分享标题

desc: _this.desc, // 分享描述

link: _this.link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致

imgUrl: _this.imgUrl, // 分享图标

success: function () {

_this.sharebg = false;

Toast.fail({duration: 1500,message: '分享成功',type: 'text'})

},

cancel: function () {

_this.sharebg = false;

Toast.fail({duration: 1500,message: '取消分享',type: 'text'})

}

});

});

}

获取签名方式直接传当前url,我尝试弹出当前url,是正确传入url;现在的问题是微信开发者工具显示ok;安卓正确分享,问题出现在ios手机上,有时候分享成功,有时候分享错误;debug显示invalid signature;请问这个问题如何解决?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值