简体   繁体   中英

Social Sharing in Cordova Application IOS

I am trying to share image particularly in WeChat and WhatsApp by using this plugin : EddyVerbruggen/SocialSharing-PhoneGap-Plugin

window.plugins.socialsharing.shareVia('whatsapp','msg',null, 
      'images/hello.png' , null /* url */, function(e) {
   console.log('share' +e)
 }, function(errormsg){
   alert(errormsg)
 })

window.plugins.socialsharing.shareVia('com.tencent.mm','msg',null, 
      'images/hello.png' , null /* url */, function(e) {
   console.log('share' +e)
 }, function(errormsg){
   alert(errormsg)
 })

My app gets crashed in ios but in android it works fine.

by using another method shareViaWhatsapp:

window.plugins.socialsharing.shareViaWhatsApp('Message via WhatsApp' 
  ,'images/hello.png', function() {
        console.log('share ok')
        }, function(errormsg){
           alert(errormsg)
        })

This method working in android but in ios its showing all the apps to share when i share image, If i share only message its working properly in ios. Please guide me.

Sharing to whatsApp with shareViaWhatsApp is not working on iOs also in my case I can confirm. Only way I was able to share picture was using share sheet with the plugin you mentioned. So its something like:

 this.socialSharing.share(null, null, this.screen, null).then(() => { console.log(' succ share test') this.shareWhatsApp() }).catch((e) => { console.log(' err share test') this.shareWhatsApp() }); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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