莫逖
莫逖
  • 发布:2020-04-10 17:09
  • 更新:2021-01-03 11:40
  • 阅读:664

通过plus.share在安卓上无法获取到QQ

分类:HTML5+

求教大佬,通过plus方法做分享功能,在Hbuild测试还有ios上都能检测到QQ,也可以成功分享,但是安卓打完包就不行,获取不到QQ对象。怎么解决
// 更新分享列表
var ss = this.shares['weixin'];
ss && ss.nativeClient && (
this.shareBts.push({
title: '微信好友',
s: ss,
x: 'WXSceneSession',
name: 'wx_friend'
}),
this.shareBts.push({
title: '微信朋友圈',
s: ss,
x: 'WXSceneTimeline',
name: 'wx_pyq'
}));
ss = this.shares['qq'];
ss && ss.nativeClient && this.shareBts.push({
title: 'QQ',
s: ss,
name: 'qq'
});
ss = this.shares['sinaweibo'];
ss && ss.nativeClient && this.shareBts.push({
title: '新浪微博',
s: ss,
name: 'weibo'
});

2020-04-10 17:09 负责人:无 分享
已邀请:
莫逖

莫逖 (作者)

代码如下 求教大佬解决方案 困扰很久了

updateSerivces() {
var that=this;
plus.share.getServices(function (s) {
that.outLine(JSON.stringify(s))
// let data=JSON.parse('[{"id":"qq","description":"QQ","authenticated":true,"nativeClient":true},{"id":"tencentweibo","description":"腾讯微博","authenticated":false,"accessToken":"","nativeClient":false},{"id":"weixin","description":"微信","authenticated":true,"nativeClient":true},{"id":"sinaweibo","description":"新浪微博","authenticated":true,"accessToken":"2.00unFNwGnpUszDe30d82130c03sNjy","nativeClient":true}]')
// that.shares = {};
// for (var i in data) {
// var t = data[i];
// that.shares[t.id] = t;
// }

            that.shares = {};  
            for (var i in s) {  
                var t = s[i];  
                that.shares[t.id] = t;  
            }  
            that.outLine(JSON.stringify(that.shares))  
            that.shareHref();  
        }, function (e) {  
            that.outLine('获取分享服务列表失败:' + e.message)  
            console.log('获取分享服务列表失败:' + e.message);  
        });  
    },  

    // 分析链接  
    shareHref() {  
        // 更新分享列表  
        var ss = this.shares['weixin'];  
        ss && ss.nativeClient && (  
        this.shareBts.push({  
            title: '微信好友',  
            s: ss,  
            x: 'WXSceneSession',  
            name: 'wx_friend'  
        }),  
        this.shareBts.push({  
            title: '微信朋友圈',  
            s: ss,  
            x: 'WXSceneTimeline',  
            name: 'wx_pyq'  
        }));  
        ss = this.shares['qq'];  
        ss && ss.nativeClient && this.shareBts.push({  
            title: 'QQ',  
            s: ss,  
            name: 'qq'  
        });  
        ss = this.shares['sinaweibo'];  
        ss && ss.nativeClient && this.shareBts.push({  
            title: '新浪微博',  
            s: ss,  
            name: 'weibo'  
        });  
        // 弹出分享列表  
        // shareBts.length > 0 ? plus.nativeUI.actionSheet({  
        //     title: '分享链接',  
        //     cancel: '取消',  
        //     buttons: shareBts  
        // }, function (e) {  
        //     (e.index > 0) && shareAction(shareBts[e.index - 1], true);  
        // }) : plus.nativeUI.alert('当前环境无法支持分享链接操作!');  
        this.outLine(JSON.stringify(this.shareBts))  
    },
2***@qq.com

2***@qq.com

一样的问题,真机调试都正常,我还有个跳转到小程序上也是一样的情况,请问解决了吗

该问题目前已经被锁定, 无法添加新回复