简体   繁体   English

为什么Ionic社交共享插件不起作用?

[英]Why is Ionic social sharing plugin not working?

When I am trying to use Ionic's social sharing plugin ( https://ionicframework.com/docs/native/social-sharing/ ) I receive the following error message: ERROR: Plugin 'SocialSharing' not found, or is not a CDVPlugin. 当我尝试使用Ionic的社交共享插件( https://ionicframework.com/docs/native/social-sharing/ )时,收到以下错误消息:错误:找不到插件'SocialSharing',或者不是CDVPlugin。 Check your plugin mapping in config.xml. 在config.xml中检查您的插件映射。

I am testing on an mobile device (Iphone 7 - IOS 12 - and the error shows up in Xcode). 我正在移动设备(Iphone 7-IOS 12-上进行测试,并且该错误在Xcode中显示)。

The way I am trying to open the social share is: 我尝试打开社交分享的方式是:

this.socialSharing.shareViaFacebook(null, null, link).then(() => {
    console.log('I'm in');
}).catch((error) => {
    console.log('err', error);
});

In my config.xml I already have: 在我的config.xml中,我已经有:

<plugin name="cordova-plugin-x-socialsharing" spec="5.4.4">
    <variable name="ANDROID_SUPPORT_V4_VERSION" value="24.1.1+" />
</plugin>

What could be the cause of this issue ? 可能是这个问题的原因?

Thank you! 谢谢!

The plugin 插件

cordova-plugin-x-socialsharing 

has an issue in the version you are using and the build fails with: 您使用的版本存在问题,并且构建失败并显示:

FAILURE: Build failed with an exception.

* Where:
Build file '/home/mj/projects/benara-sales-client/platforms/android/build.gradle' line: 266

* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not get unknown property 'ANDROID_SUPPORT_V4_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

To fix, you may install v5.4.0 要修复,您可以安装v5.4.0

so remove the plugin and the correct version (you have 5.4.4, try 5.4.0) 因此删除插件和正确的版本(您有5.4.4,请尝试5.4.0)

cordova plugin rm cordova-plugin-x-social-sharing
cordova plugin add cordova-plugin-x-social-sharing@5.4.0

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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