簡體   English   中英

如何使用Ionic在Whatsapp中共享長文本內容

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

我對WhatsApp共享有一個奇怪的問題。 我共享時不共享全文。 文字大約1000行,但不能共享所有行! 問題是什么? 文字有限制嗎? 我正在使用這個插件: 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在單個消息中具有字符數限制,它的65536是2 ^ 16。 因此,使您的數學計算文本長度。


  1. 為確保其不是插件/您的​​代碼問題,請通過郵件共享長文本。 如果一切正常,那么它有Whatsapp限制,您與之無關,但可以將長文本拆分為多個塊並發送幾條消息
  2. 手動復制長文本並粘貼在Whatsapp中,我相信您會得到相同的行為

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM