【问题标题】:How we can implement add to any(Social networking) in MobileFirst我们如何在 MobileFirst 中实现添加到任何(社交网络)
【发布时间】:2015-02-18 06:32:40
【问题描述】:

我们如何实现添加到任何社交网络小部件以在 Mobilefirst 平台的 facebook、twitter 等中分享照片。 我试过http://www.addthis.com/的插件 它正在公共资源中进行预览,但在 Android 和 Windows 8 模拟器和设备中失败。

任何人都可以为 MobileFirst Platform 推荐任何其他插件吗? 也通过以下代码尝试了 jquery 共享,但不起作用。

$('#mydiv').share({
        networks: ['facebook','pinterest','googleplus','twitter','linkedin','tumblr','in1','email','stumbleupon','digg']
    });

 <div id="mydiv"></div>

【问题讨论】:

  • 说明您希望它为您的应用程序完成什么。

标签: ibm-mobilefirst


【解决方案1】:

更新:有关更多信息,请参阅此博客文章:https://developer.ibm.com/mobilefirstplatform/2015/08/03/integrating-3rd-party-cordova-plug-ins/

提到的“插件”似乎不适合移动应用 IMO。
你可以用谷歌搜索 Cordova 社交分享插件。

PhoneGap Social Sharing plugin 是一个很有前途的 Android、iOS 和 Windows Phone 插件。

注意:您不能使用 Cordova CLI 安装步骤在 Worklight/MobileFirst Platform 中安装插件。相反,您需要遵循提供的手动说明。

在这样做之前,最好先阅读MFP tutorial for working with Cordova plug-ins,以便了解它在 MFP 中的工作原理。


我通过一些额外的调整让它在 iOS 上工作。

注意:

  • Android 和 Windows Phone 8 以及它们各自的环境都需要步骤 2
  • 在 MobileFirst Studio 中每次构建后都需要重复第 2 步,因为此文件在每次构建时都会被覆盖。

步骤:

  1. 缺少两个框架:
    • MessageUI.framework
    • Social.framework

  2. 使用额外部分更新(在 Xcode 中)www\worklight\cordova_plugins.js

     {
         "file": "../js/SocialSharing.js",
         "id": "nl.x-services.plugins.socialsharing",
         "clobbers": [
             "window.plugins.socialsharing"
         ]
     }
    

    注意:SocialSharing.js 应放在 common\js 中,并在 index.html 的 HEAD 元素中引用

  3. 编辑 SocialSharing.js,用

    包裹整个内容
    cordova.define("nl.x-services.plugins.socialsharing", function(require, exports, module) {
        // file contents
    ); 
    
  4. 在您的 HTML 中,从可用选项中选择您想要的任何共享选项(请参阅插件文档)。

最终结果:

【讨论】:

    猜你喜欢
    • 2010-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-30
    • 2020-03-03
    • 2013-08-22
    • 2013-11-05
    • 1970-01-01
    相关资源
    最近更新 更多