let scope = 'snsapi_userinfo';
let state = 'wechat_sdk_demo';
WeChat.isWXAppInstalled()
.then(isInstalled => {
if(isInstalled){
console.log("有安装微信")
WeChat.sendAuthRequest(scope)
.then(responseCode => {
console.log(responseCode)
//返回code码,通过code获取access_token
alert(responseCode.code);
})
.catch(err => {
console.log(err)
alert('登录授权发生错误:', err.message);
})
}else{
alert('没有安装微信')
}
只打印出"有安装微信",之后没有任何反应了.........
registerApp返回true
getApiVersion和openWXApp都没问题.
sendAuthRequest、shareToSession和shareToTimeline就不行
shareToSession和shareToTimeline只是闪动了一下,转了半秒菊花,然后就没然后了。
sendAuthRequest直接没任何反应(then和catch都没有返回值)
有大神救赎一下吗
问题解决了,是由于包名和签名问题,需要在微信开发平台上设置的。
至少说下怎么设置吧...
duplicate #346
Most helpful comment
至少说下怎么设置吧...