获取shareTicket为undefined情况

发布于 7 年前作者 weizhong2254 次浏览最后编辑 7 年前来自 ask
  • 当前 Bug 的表现(可附上截图)
  • 预期表现

当用户将小程序转发到任一群聊之后,此转发卡片在群聊中被其他用户打开时,可以在 App.onLaunch 或 App.onShow 获取到一个 shareTicket, 目前设置过

wx.showShareMenu({

withShareTicket: true

}), 别人在群里点开打印日志是undefined

  • 复现路径

代码如下:

设置过

wx.showShareMenu({

withShareTicket: true

})

onShow (options) {

console.log(‘jamesAAA’ + options.shareTicket)

wx.getShareInfo({

shareTicket: options.shareTicket,

success: (res)=> {

console.log('Jamesjamesjames: ’ + res.encryptedData)

},

fail: function (res) { console.log('Jamesjamesjames: ’ + res) },

complete: function (res) { console.log('Jamesjamesjames: ’ + res) }

})

}

1 回复
jun30
jun301 楼5 年前

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)