uni-app 分享到微信在安卓测试时提示由于不支持的分享类型无法分享到微信

uni-app 分享到微信在安卓测试时提示由于不支持的分享类型无法分享到微信

类别 信息
产品分类 uniapp/App
PC开发环境 Windows
PC版本号 win10
HBuilderX类型 正式
HBuilderX版本 3.3.11
手机系统 Android
手机版本号 Android 10
手机厂商 红米
手机机型 note 9
页面类型 vue
vue版本 vue2
打包方式 云端
项目创建方式 HBuilderX

示例代码:

shareFriend: function() {
    //分享到微信朋友
    uni.share({
        provider: "weixin",
        scene: "WXSceneSession",
        type: 0,
        href: 'http://192.168.3.46:8080/#/pages/index/marker?id=' + this.id,
        title: "你笑起来真好看",
        summary: "唐艺昕,你有火吗?没有,为何你点燃了我的心?",
        imageUrl: "/static/image/wx.png",
        success: function(res) {undefined
            console.log("success:" + JSON.stringify(res));
        },
        fail: function(err) {undefined
            console.log("fail:" + JSON.stringify(err));
        }
    });
}

操作步骤:

shareFriend: function() {
    //分享到微信朋友
    uni.share({
        provider: "weixin",
        scene: "WXSceneSession",
        type: 0,
        href: 'http://192.168.3.46:8080/#/pages/index/marker?id=' + this.id,
        title: "你笑起来真好看",
        summary: "唐艺昕,你有火吗?没有,为何你点燃了我的心?",
        imageUrl: "/static/image/wx.png",
        success: function(res) {undefined
            console.log("success:" + JSON.stringify(res));
        },
        fail: function(err) {undefined
            console.log("fail:" + JSON.stringify(err));
        }
    });
}

预期结果:

分享正常

实际结果:

提示由于不支持的分享类型 无法分享到微信

bug描述:

在安卓测试时,分享到微信,分享不了,提示由于不支持的分享类型 无法分享到微信

在manifest.json也勾选了分享,也填了在微信开放平台申请的appid ,appid也是对的,包名也都一样,但是还是没有办法正常分享

Image Image Image


更多关于uni-app 分享到微信在安卓测试时提示由于不支持的分享类型无法分享到微信的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

图片多大?
imageUrl String type 为 0、2、5 时必选 图片地址。type为0时,推荐使用小于20Kb的图片

更多关于uni-app 分享到微信在安卓测试时提示由于不支持的分享类型无法分享到微信的实战教程也可以访问 https://www.itying.com/category-93-b0.html


已经解决了,谢谢,不是代码的问题,是打包的时候,用的云端证书,导致无法分享的,改成使用自有证书,就可以了

回复 1***@qq.com: 我也遇到了,怎么解决的呀?

这个问题通常是由于微信分享配置不正确导致的。根据你提供的信息,我建议检查以下几点:

  1. 确保微信开放平台的应用签名正确。安卓应用签名需要使用签名工具获取,不能直接使用包名。可以使用微信提供的签名生成工具获取正确的签名。

  2. 检查manifest.json中的微信分享配置是否正确:

"app-plus" : {
    "distribute" : {
        "android" : {
            "permissions" : [
                "<uses-permission android:name=\"android.permission.INTERNET\"/>"
            ]
        }
    },
    "oauth" : {
        "weixin" : {
            "appid" : "你的微信appid",
            "appsecret" : "你的微信appsecret"
        }
    }
}
  1. 尝试修改分享类型为5(网页链接):
uni.share({
    provider: "weixin",
    scene: "WXSceneSession",
    type: 5,  // 改为网页类型
    href: 'http://192.168.3.46:8080/#/pages/index/marker?id=' + this.id,
    title: "你笑起来真好看",
    summary: "唐艺昕,你有火吗?没有,为何你点燃了我的心?",
    imageUrl: "/static/image/wx.png"
});
回到顶部