簡體   English   中英

從使用Phonegap構建的iOS應用發布到Facebook牆

[英]Post to facebook wall from iOS app which is build using Phonegap

我有一個使用Phonegap構建的應用程序,所以我擁有的全部HTML和Java腳本。
我可以使用兩行目標C代碼檢查facebook是否安裝在特定設備上或不在我的應用程序中。
我想在我的應用中添加一個Facebook分享按鈕,
通過單擊,將從我的應用程序中打開facebook應用程序,並將一些數據發布到用戶的牆上,我可以將其傳遞給此應用程序調用。

您為什么不嘗試將FacebookConnect插件用於Phonegap,它適用於iOS和Android。

請下載示例應用程序,然后在您的代碼中嘗試以下代碼段:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <link rel="stylesheet" type="text/css" href="css/plugin.css" />
        <title>Hello World</title>
    </head>
    <body>
        <div class="app">
            <h1>Apache Cordova</h1>
            <div id="deviceready" class="blink">
                <p class="event listening">Connecting to Device</p>
                <p class="event received">Device is Ready</p>
            </div>
            <div id="plugindemo">
                <h3>FacebookConnect Plugin</h3>
                <a href="#" class="btn large" onclick="plugin.login();">login()</a>
                <a href="#" class="btn large" onclick="plugin.requestWithGraphPath();">requestWithGraphPath()</a>
                <a href="#" class="btn large" onclick="plugin.dialog();">dialog()</a>
                <a href="#" class="btn large" onclick="plugin.logout();">logout()</a>
            </div>
        </div>
        <script type="text/javascript" src="cordova-2.2.0.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript" src="js/plugin.js"></script>
        <script type="text/javascript" src="js/FacebookConnect.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
</html>

暫無
暫無

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

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