簡體   English   中英

Phonegap / Cordova:社交共享插件不起作用

[英]Phonegap / Cordova: socialsharing plugin not working

我將社交共享插件包含在config.xml中,如下所示:

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

(使用cordova v。3.3.1)

在我的html中,我包括:

<script src="phonegap.js"></script>  
 or
<script src="cordova.js"></script>  

現在調用時:

function shareReport() {
window.plugins.socialsharing.share(mytext);
}

通過一個按鈕:

onclick="shareReport()"

程序突然停止並關閉。 (“ mytext”是一個全局變量,其中填充了包含html標簽的文本字符串-此變量此時具有一個值)

有什么建議出什么問題嗎?

克里斯,謝謝你

社交共享插件將按預期工作,因此您似乎錯過了一些東西,請檢查以下字段的XML,

<!-- for iOS -->
<feature name="SocialSharing">
  <param name="ios-package" value="SocialSharing" />
</feature>
<!-- for Android -->
<feature name="SocialSharing">
  <param name="android-package" value="nl.xservices.plugins.SocialSharing" />
</feature>
<!-- for Windows Phone -->
<feature name="SocialSharing">
  <param name="wp-package" value="SocialSharing"/>
</feature>

AndroidManifest.xml:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

檢查您的腳本,

<script type="text/javascript" src="js/SocialSharing.js"></script>

這是必須的

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

試駕,

<button onclick="window.plugins.socialsharing.canShareVia('com.apple.social.facebook', 'msg', null, null, null, function(e){alert(e)}, function(e){alert(e)})">is facebook available on iOS?</button>

希望這可以幫助。

好,我知道了。 沒錯,SocialSharing插件的工作原理如下:

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

進入config.xml。 我的問題出在我發送用於共享的文本中不可接受的字符,導致程序崩潰。 多謝您的協助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM