uni.share({  
                provider: "weixin",  
                scene: "WXSenceTimeline",  
                type: 2,  
                imageUrl: that.posterImg,  
                success: function(res) {  
                    uni.showToast({  
                        title: '分享成功',  
                        icon: 'none'  
                    })  
                },  
                fail: function(err) {  
                    console.log("fail:" + JSON.stringify(err));  
                }  
            });  
uni.share({  
                provider: "weixin",  
                scene: "WXSceneSession",  
                type: 2,  
                imageUrl: that.posterImg,  
                success: function(res) {  
                    uni.showToast({  
                        title: '分享成功',  
                        icon: 'none'  
                    })  
                },  
                fail: function(err) {  
                    console.log("fail:" + JSON.stringify(err));  
                }  
            });                                    - 发布:2021-04-22 16:58
 - 更新:2021-04-23 14:38
 - 阅读:1028
 
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: Windows 10 教育版
HBuilderX类型: 正式
HBuilderX版本号: 3.1.9
手机系统: Android
手机系统版本号: Android 11
手机厂商: 小米
手机机型: 小米11
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
                                    
                                    
                                         
                                
                                                                                                操作步骤:
                                    
                                        uni.share({  
                provider: "weixin",  
                scene: "WXSenceTimeline",  
                type: 2,  
                imageUrl: that.posterImg,  
                success: function(res) {  
                    uni.showToast({  
                        title: '分享成功',  
                        icon: 'none'  
                    })  
                },  
                fail: function(err) {  
                    console.log("fail:" + JSON.stringify(err));  
                }  
            });  
uni.share({  
                provider: "weixin",  
                scene: "WXSceneSession",  
                type: 2,  
                imageUrl: that.posterImg,  
                success: function(res) {  
                    uni.showToast({  
                        title: '分享成功',  
                        icon: 'none'  
                    })  
                },  
                fail: function(err) {  
                    console.log("fail:" + JSON.stringify(err));  
                }  
            });
                                     
                                
                                                                                                uni.share({  
                provider: "weixin",  
                scene: "WXSenceTimeline",  
                type: 2,  
                imageUrl: that.posterImg,  
                success: function(res) {  
                    uni.showToast({  
                        title: '分享成功',  
                        icon: 'none'  
                    })  
                },  
                fail: function(err) {  
                    console.log("fail:" + JSON.stringify(err));  
                }  
            });  
uni.share({  
                provider: "weixin",  
                scene: "WXSceneSession",  
                type: 2,  
                imageUrl: that.posterImg,  
                success: function(res) {  
                    uni.showToast({  
                        title: '分享成功',  
                        icon: 'none'  
                    })  
                },  
                fail: function(err) {  
                    console.log("fail:" + JSON.stringify(err));  
                }  
            });                                    预期结果:
                                    
                                    
                                        成功分享图片
                                     
                                
                                                                                                成功分享图片
实际结果:
                                    
                                    
                                        显示分享成功,可是图片并没有发出
                                     
                                
                                                            显示分享成功,可是图片并没有发出
bug描述:
分享朋友圈或者好友,回调显示发送成功,实际并没有发送出去,在 android 其他OS都可以,就是在 android11不行
            
            
            
            
1***@qq.com (作者)
图片地址:_doc/uniapp_temp_1619162684693/canvas/16191627116910.png 这是通过canvas生成的图片
2021-04-23 15:25
1***@qq.com (作者)
解决办法
var p = plus.io.convertLocalFileSystemURL(that.posterImg);
let PImg = 'file:///'+p;
2021-04-23 15:42
DCloud_Android_ST
回复 1***@qq.com: 你的意思是说 "_doc/xxx"写法的图片不生效? 需要转绝对路径?我们试下
2021-04-23 16:25
1***@qq.com (作者)
回复 DCloud_Android_ST: 对
2021-04-23 16:53