简体   繁体   中英

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

I have an app build using Phonegap, so total HTML and Java Scripts thats all I have.
I can check using two lines of objective C code that facebook is installed on perticular device or not within my app.
I want to have a facebook share button in my app,
by clicking on which will open facebook app from my app and will post some data on user's wall which I can pass over this app call.

Why don't you try FacebookConnect Plugin for Phonegap, it works for iOS and Android.

Please download sample application and try in the following snippet in you code:

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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