Telerik-Verified-Plugins / SocialSharing

This PhoneGap plugin allows you to share text, an image, or a URL (or all three) via the native sharing widget of your Android, iOS or WP8 device.
27 stars 6 forks source link

I am facing cannot read socialsharing #23

Open Abdulzabeer opened 4 years ago

Abdulzabeer commented 4 years ago

var cordova = window.cordova; shareVia(type?: string, message?: string, subject?: string, file?: any) { return new Promise((resolve, reject) => { var options = { message: '', subject: '', files: [file], } var onSuccess = function (result) { resolve(result) }

var onError = function (msg) {
  reject(msg)
}
if (cordova.plugins.socialsharing) {
  document.addEventListener('deviceready', ()=>{
    cordova.plugins.socialsharing.shareWithOptions(options, onSuccess, onError);
  }, false); 

} else {
  reject('Plugin not available');
}

}); }

error:-vendor.js:39963 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'socialsharing' of undefined TypeError: Cannot read property 'socialsharing' of undefined at main.js:385 at new ZoneAwarePromise (polyfills.js:4280) at AppComponent.push../src/app/app.component.ts.AppComponent.shareVia (main.js:373) at main.js:365 at new ZoneAwarePromise (polyfills.js:4280) at AppComponent.push../src/app/app.component.ts.AppComponent.add (main.js:364) at Object.eval [as handleEvent] (AppComponent.html:2) at handleEvent (vendor.js:65200) at callWithDebugContext (vendor.js:66270) at Object.debugHandleEvent [as handleEvent] (vendor.js:65997) at resolvePromise (polyfills.js:4201) at polyfills.js:4111 at main.js:368 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:3740) at Object.onInvoke (vendor.js:62217) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:3739) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (polyfills.js:3499) at polyfills.js:4259 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:3772) at Object.onInvokeTask (vendor.js:62208)