Ionic Native Social Sharing - Error: Plugin not installed

Hi,

I’m using an Ionic 3 app, trying to get social sharing working.

I followed the steps to install the Ionic Native Social Sharing plugin from: https://ionicframework.com/docs/v3/native/social-sharing/

Ran:

$ ionic cordova plugin add cordova-plugin-x-socialsharing
$ npm install --save @ionic-native/social-sharing@4

Imported the plugin (version 4.x.x) via my app module and added SocialSharing to the providers array.

Imported the plugin via my app.component using:

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

Added to the constructor:

private socialSharing: SocialSharing

This share function, also in app.component is triggered via a button in the html (side menu):

async share() {
    try {
      // Pop the native social sharing sheet, allowing the user to choose how to share the app.
      await this.socialSharing.share(this.shareMessage, this.shareSubject, this.shareFile, this.getShareUrl());
      this.toast.show('Thanks for sharing!', 3000);
    }
    catch(err) {
      console.error(err);
      alert(err);
    }
  }

I’m using platforms: ios, android and browser.

When I call the method from a build on a real device I get the error:

"Plugin is not installed"

Tried:

  1. Checking logs for installation errors. None seen.
  2. Reinstalled plugin.
  3. Checked plugin present using $ionic cordova plugin list. cordova-plugin-x-socialsharing 5.4.7 “SocialSharing” is present.
  4. Removed and added all platforms again.
  5. Wrapped the share method inside a platform.ready().

Nothing seems to be working. I cannot get the app to recognise the plugin is installed!

PLEASE HELP! :slight_smile: What can I try next?

Thanks