简体   繁体   English

如何使用Ionic在Whatsapp中共享长文本内容

[英]How to share long text content in Whatsapp using Ionic

I have strange problem with WhatsApp sharing. 我对WhatsApp共享有一个奇怪的问题。 When I am sharing it doesn't share full text. 我共享时不共享全文。 Text is arround 1000 lines but not share all lines!! 文字大约1000行,但不能共享所有行! What is the problem? 问题是什么? Is there any limit to text? 文字有限制吗? I am using this plugin : https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin 我正在使用这个插件: https : //github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin

sharedata() {
    let msgToShare = '*Data1*' + '\r\n' + this.maindata.d1+ '\r\n' + this.maindata.d2+ '\r\n\n' + '*Data2*' + this.maindata.d3+ '\r\n\n' + '*Data3*' + this.maindata.d4+ '\r\n\n' + '*Data4' + this.maindata.d5+ '\r\n\n' + '*Data5*' + this.maindata.d6;
    console.log(msgToShare);
    var options = {
        message: msgToShare
    }

    var onSuccess = function (result) {
        console.log("Share completed? " + result.completed); // On Android apps mostly return false even while it's true
        console.log("Shared to app: " + result.app); // On Android result.app is currently empty. On iOS it's empty when sharing is cancelled (result.completed=false)
    }

    var onError = function (msg) {
        console.log("Sharing failed with message: " + msg);
    }
    window['plugins'].socialsharing.shareWithOptions(options, onSuccess, onError);
}

Whatsapp has limit of number of characters in a single message and it's 65536 that is 2^16. Whatsapp在单个消息中具有字符数限制,它的65536是2 ^ 16。 So make your mathematics to calculate text length. 因此,使您的数学计算文本长度。


  1. To be sure that its not plugin/your code problem, share long text via mail. 为确保其不是插件/您的​​代码问题,请通过邮件共享长文本。 If everything is ok, therefore its Whatsapp restrictions and you have nothing to do with that but split long text to chunks and send several messages 如果一切正常,那么它有Whatsapp限制,您与之无关,但可以将长文本拆分为多个块并发送几条消息
  2. Copy long text manually and paste in Whatsapp, I believe you will get the same behavior 手动复制长文本并粘贴在Whatsapp中,我相信您会得到相同的行为

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 离子电容器共享插件不与whatsapp共享图像 - ionic capacitor share plugin not sharing image with whatsapp 如何创建贴纸应用程序并将其使用ionic或React native等JS框架发送到WhatsApp或任何Messenger? - how to create a sticker App and send them to WhatsApp or any messenger using JS Frameworks like ionic or React native? 如何在 Ionic5 项目中使用 SocialShare 插件共享本地文件? - How to share a local file using SocialShare Plugin in Ionic5 project? 使用 WebRTC 在 Ionic 中进行屏幕共享 - Screen Share in Ionic using WebRTC 当我尝试通过whatsapp共享链接时,收到消息**共享失败,请重试** - getting message **sharing failed please try again** in ionic app when I try to share link via whatsapp 无法使用Ionic2 / 3 Social Share共享图像 - Unable to share image using Ionic2/3 Social Share 如何在Ionic 2中跨组件共享变量? - How to share variables across components in Ionic 2? 如何在离子中显示共享底页以进行文件共享? - how to show share bottomsheet in ionic for file sharing? 如何在 Android/IOS 设备上使用 jsPDF for PDF 和 SharePicker 在 Ionic 4 中生成和共享 PDF - How to Generate and Share PDF on Android/IOS Device using jsPDF for PDF and SharePicker for Sharing in Ionic 4 如何使用 Angular 在社交网站中共享自定义文本 - How to share Custom Text in social website using Angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM