首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >离子5 socialSharing.shareViaWhatsAppToPhone不附像

离子5 socialSharing.shareViaWhatsAppToPhone不附像
EN

Stack Overflow用户
提问于 2022-02-02 01:40:43
回答 1查看 743关注 0票数 1

我正在使用社交分享插件在Ionic 5和有问题在分享图像通过whatsApp。如果我通过"shareViewWhatsApp“分享图像,那么一切都很好。在选择联系人后,它显示了我正在分享的图像。

但是,如果我使用"shareViaWhatsAppToPhone“或"shareViaWhatsAppToReceiver”直接共享图像whatsapp联系人,那么它似乎忽略了该图像,只共享文本消息。

代码语言:javascript
复制
var node = document.getElementById('body') ;
domtoimage.toPng(node) 
    .then((dataUrl) => {
      this.socialSharing.shareViaWhatsAppToPhone('+61xxxxxxxxx','share toPhone', dataUrl,null).then((res) => {
        console.log('image shared with whatsapp');
      }).catch((e) => {
        console.error('social share, something went wrong!', e);
      });
    })
    .catch((error) => {
        console.error('oops, something went wrong!', error);
    });

"domtoimage.toPng()“只是一个插件,用于将Dom节点转换为图像。参考文献:https://github.com/tsayen/dom-to-image

dataUrl看起来像:“数据:image/png;base64 64,iVBORw0KGgoAAAANSUhEUg.”

任何帮助都是徒劳无功的。

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-02-02 07:48:16

嗨,我之前也有过同样的问题,后来我在这个文档(https://www.npmjs.com/package/cordova-plugin-x-socialsharing)中发现,它清楚地提到在android中文件被忽略,同时直接发送到数字。

所以你可以尝试一下

代码语言:javascript
复制
this.socialSharing.shareViaWhatsApp('share toPhone', dataUrl,null).then((res) => {
      console.log('image shared with whatsapp');
    }).catch((e) => {
      console.error('social share, something went wrong!', e);
    });
  })
  .catch((error) => {
      console.error('oops, something went wrong!', error);
  });
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70949678

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档