想拿到群信息,按照文档的2种方法是调用getShareInfo,参数是shareTicket;
1: 从1044场景进入:
代码:
onLaunch: function (e) { console.log( "================onLaunch================\n" ,e) shareTicket = e.shareTicket; wx.getShareInfo({ "shareTicket" : shareTicket,complete: function (res){ console.log( "================getShareInfo complete================\n" ,res) |
2: 点击分享后回调:
代码:
onShareAppMessage: function () { return { title: '分享!' , path: '/pages/duel/duel?share_id=' + userId, success: function (res) { console.log( "================share success================\n" , res) ; // wx.getShareInfo(); var shareTickets = res.shareTickets; wx.getShareInfo({ shareTicket: shareTickets[0], complete: function (res) { console.log( "================getShareInfo callback================\n" ,res); } }); }, fail: function (res) { console.log( "share fail" ) } } |
结果:
设置应用场景:1044
必须选择进入的群(不选择可以拿到shareTicket,但是无效)
保存为默认编译模式(不然进去还是1001场景)
同样遇到这个问题,本来可以的,突然就报这个错了
我也遇到这个问题了。忽略吧,这个应该是编译器的问题
遇到同样错误,但真机可以获取
没人理。。