繁体   English   中英

当我尝试通过whatsapp共享链接时,收到消息**共享失败,请重试**

[英]getting message **sharing failed please try again** in ionic app when I try to share link via whatsapp

说明-: 1.我正在开发离子项目,试图通过whatsapp共享链接

  1. 我已经使用shareViaWhatsApp(message, image, url)函数从https://ionicframework.com/docs/native/social-sharing/

  2. 我已经按照所有步骤查看了Ionic提供的文档

  3. 但是问题是-:

    当我尝试通过whatsapp窗口打开共享链接但它提示消息共享失败时,请重试,然后关闭whatsapp窗口, 共享失败

我把代码放在下面-

  shareViaWhatsapp(){
    console.log('invitewhatsapp');
    let message = 'Abcd';
    //let image = 'sdfgbdh.jpg';
    let url = "www.facebook.com";
    this.socialShare
      .shareViaWhatsApp(message,url,null)
      .then(() => {
        console.log('success');
      })
      .catch(() => {
        console.log('Error');
      });
  }

html->

<button ion-fab (click)="shareViaWhatsapp()"><ion-icon name="logo-whatsapp"></ion-icon></button>

第二个参数用于图像,第三个参数用于URL。 用以下代码替换您的代码:

this.socialShare
  .shareViaWhatsApp("Abcd",undefined,"www.facebook.com")
  .then(() => {
    console.log('success');
  })
  .catch(() => {
    console.log('Error');
  });

有关通过whatsapp共享的更多信息

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM