首页 > 解决方案 > 无法使用 ionic cordova 社交分享插件分享到 Facebook

问题描述

我无法使用@ionic-native/social-sharing. 这是我的.ts文件。

import { Component } from '@angular/core';
import { SocialSharing } from '@ionic-native/social-sharing';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  img: String = 'https://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2011/1/12/1294859657274/Earth-007.jpg'

  result: any
  reason: any

  constructor(public sharing: SocialSharing) { }

  fb() {
    this.sharing.shareViaFacebook(msg, img, url)
      .then((result: any) => {
        this.result = result
      })
      .catch((reason: any) => {
        this.reason = reason
      })
  }
}

fb()函数执行时,它catch使用 this命中reason

[
"com.android.bluetooth",
"com.android.nfc",
"com.google.android.apps.docs",
"com.google.android.apps.docs",
"com.google.android.apps.messaging",
"com.google.android.apps.translate",
"com.google.android.gm",
"com.google.android.talk",
"com.verizon.messaging.vzmsgs",
"com.estmob.android.sendanywhere",
"com.facebook.orca",
"com.skype.raider",
"nextapp.fx"
]

通过电子邮件共享按预期工作。通过 Twitter 分享也不起作用 - 使用此reason

[
"com.amazon.kindle",
"com.android.bluetooth",
"com.android.nfc",
"com.google.android.apps.docs",
"com.google.android.apps.maps",
"com.google.android.apps.messaging",
"com.google.android.apps.photos",
"com.google.android.gm",
"com.google.android.talk",
"com.vcast.mediamanager",
"com.vcast.mediamanager",
"com.verizon.messaging.vzmsgs",
"com.estmob.android.sendanywhere",
"com.facebook.orca",
"com.google.android.street",
"com.skype.raider",
"nextapp.fx"
]

标签: cordovaionic-framework

解决方案


推荐阅读