我正在使用社交分享插件在Ionic 5和有问题在分享图像通过whatsApp。如果我通过"shareViewWhatsApp“分享图像,那么一切都很好。在选择联系人后,它显示了我正在分享的图像。
但是,如果我使用"shareViaWhatsAppToPhone“或"shareViaWhatsAppToReceiver”直接共享图像whatsapp联系人,那么它似乎忽略了该图像,只共享文本消息。
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.”
任何帮助都是徒劳无功的。
谢谢
发布于 2022-02-02 07:48:16
嗨,我之前也有过同样的问题,后来我在这个文档(https://www.npmjs.com/package/cordova-plugin-x-socialsharing)中发现,它清楚地提到在android中文件被忽略,同时直接发送到数字。

所以你可以尝试一下
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);
});https://stackoverflow.com/questions/70949678
复制相似问题