Ionic error while using social plugin

Asked

Viewed 312 times

0

I’m trying to use the plugin socialSharing, I followed every step of this tutorial but when I press the button turns on the share function I get the error:

'Object is not a Function at socialShare.share()'

I already checked and the plugin files are there:

my Ionic info:

Ionic:

   ionic (Ionic CLI)  : 4.10.1 (/usr/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : android 7.0.0, browser 5.0.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.4, (and 10 other plugins)

System:

   Android SDK Tools : 26.1.1 (/opt/SDK)
   NodeJS            : v11.8.0 (/usr/bin/node)
   npm               : 6.5.0
   OS                : Linux 4.15

my plugins from Cordova:

cordova-plugin-device 2.0.2 "Device"
cordova-plugin-device-motion 2.0.1 "Device Motion"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-gyroscope 0.1.4 "Device Gyroscope"
cordova-plugin-ionic-keyboard 2.1.2 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.1.4 "cordova-plugin-ionic-webview"
cordova-plugin-request-location-accuracy 2.2.3 "Request Location Accuracy"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.4 "SocialSharing"
cordova-sqlite-storage 2.6.0 "Cordova sqlite storage plugin"
es6-promise-plugin 4.2.2 "Promise"

my package.json: (https://pastebin.com/dWRUGnqr)

Maybe I can help, qnd installed the plugin I received this message:

Saved plugin info for "cordova-plugin-x-socialsharing" to config.xml
config file *-Info.plist requested for changes not found at /var/www/html/git/projeto/rodoviasApp/platforms/android/*-Info.plist, ignoring
config file *-Info.plist requested for changes not found at /var/www/html/git/projeto/rodoviasApp/platforms/android/*-Info.plist, ignoring
config file *-Info.plist requested for changes not found at /var/www/html/git/projeto/rodoviasApp/platforms/browser/*-Info.plist, ignoring
config file *-Info.plist requested for changes not found at /var/www/html/git/projeto/rodoviasApp/platforms/browser/*-Info.plist, ignoring

1 answer

0


i realized that it is a version error, my Ionic Native core is 4 and the plugin asks for version 5. tidied up by installing an older version of the plugin using the command

npm install @ionic-native/social-sharing@^4

after that it was necessary to go to the config.xml file and change the following line:

   <plugin name="cordova-plugin-x-socialsharing" >

for:

   <plugin name="cordova-plugin-x-socialsharing" spec="^4.20.0">

ps.instead of 4.2 put the version q vc installed with npm in the previous step.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.