PhoneGap构建:SocialSharing插件未加载 [英] PhoneGap Build: SocialSharing Plugin Not Loading

查看:168
本文介绍了PhoneGap构建:SocialSharing插件未加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在config.ml文件中加入了以下内容:

 < gap:plugin name =nl.x-services.plugins.socialsharingversion =4.0.8/> 

这是我的HTML索引页面的示例:

 < html> 
< head>
< script type =text / javascriptsrc =SocialSharing.js>< / script>
< / head>
< body>
< section id =landmarksdata-role =page>
< button onclick =window.plugins.socialsharing.share('My message')> share!< / button>
< button onclick =window.plugins.socialsharing.share('Message only')> message only< / button>
< button onclick =window.plugins.socialsharing.shareViaTwitter('Message via Twitter')> message via Twitter< / button>
< / section>
< / body>
< / html>

当我点击按钮(从PhoneGapBuild下载应用程序后)没有任何反应。



任何想法?

解决方案

我决定切换到PhoneGap / Cordova命令行界面构建这个应用程序。当我这样做时,SocialSharing插件开始正常工作。



我相信问题是我没有正确导入 cordova.js SocialSharing.js 文件到我的源代码上传到PhoneGap Build时的index.html页面。



每个人都注意到:将 cordova.js 脚本作为您在HTML页面中导入的第一个脚本很重要,因为您可能会无意中使用一个依赖于在Cordova平台上,如果稍后导入 cordova.js 文件,则该功能将无法使用。


I am trying to use the SocialSharing Plugin with PhoneGap Build.

I have put the following into the config.ml file:

<gap:plugin name="nl.x-services.plugins.socialsharing" version="4.0.8" />

Here is a sample of my HTML index page:

<html>
    <head>
        <script type="text/javascript" src="SocialSharing.js"></script>
    </head>
    <body>
        <section id="landmarks" data-role="page">
            <button onclick="window.plugins.socialsharing.share('My message')">share!</button>
            <button onclick="window.plugins.socialsharing.share('Message only')">message only</button>
            <button onclick="window.plugins.socialsharing.shareViaTwitter('Message via Twitter')">message via Twitter</button>
        </section>
    </body>
</html>

When I tap the buttons (after downloading the app from PhoneGapBuild) nothing happens.

Any ideas?

解决方案

I decided to switch to the PhoneGap/Cordova Command Line Interface to build this app. When I did, the SocialSharing plugin began to work perfectly.

I believe the problem was that I had not correctly imported the cordova.js and SocialSharing.js files into the index.html page when I uploaded my source to PhoneGap Build.

Note to Everyone: it is important to have the cordova.js script be the first script you import in your HTML page, as you may inadvertently use a function that relies on the Cordova platform, and, if the cordova.js file is imported later, the feature will not work.

这篇关于PhoneGap构建:SocialSharing插件未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆